pvs-stdio ue4_了解适用于Java的PVS-Studio静态分析器

article/2025/9/25 18:37:03

pvs-stdio ue4

Рисунок 3

总览 (Overview)

The PVS-Studio Java static code analyzer consists of 2 main parts: the kernel, which performs the analysis, and plugins for integration in build systems (Gradle, Maven) and IDE (IntelliJ IDEA).

PVS-Studio Java静态代码分析器包括2个主要部分:内核(用于执行分析)以及用于集成到构建系统(Gradle,Maven)和IDE(IntelliJ IDEA)中的插件。

Plugins get project structure (a collection of source files and classpath), then pass this information to the analyzer core. In addition, plugins are responsible for deploying the core for analysis — it will be automatically loaded at the first run.

插件获取项目结构(源文件和类路径的集合),然后将此信息传递给分析器核心。 此外,插件负责部署核心以进行分析-它将在首次运行时自动加载。

It's also possible to run the analyzer directly, listing the sources and classpath.

也可以直接运行分析器,列出源和类路径。

Analysis can be done if your computer meets the following system requirements:

如果您的计算机满足以下系统要求,则可以进行分析:

Operating system: Windows, Linux, macOS;

操作系统:Windows,Linux,macOS;

Minimum required Java version to run the analyzer with: Java 8 (64-bit). Note: A project being analyzed could use any Java version;

运行分析仪所需的最低Java版本:Java 8(64位)。 注意:被分析的项目可以使用任何Java版本。

Minimum version of IntelliJ IDEA: 2017.2.

最低版本的IntelliJ IDEA:2017.2。

Maven插件 (Plugin for Maven)

If the project you're working on is based on the Maven build system, you can use the plugin pvsstudio-maven-plugin. To do this, you need to add the following to the pom.xml file:

如果您正在处理的项目基于Maven构建系统,则可以使用插件pvsstudio-maven-plugin。 为此,您需要将以下内容添加到pom.xml文件中:

<pluginRepositories><pluginRepository><id>pvsstudio-maven-repo</id><url>http://files.viva64.com/java/pvsstudio-maven-repository/</url></pluginRepository>
</pluginRepositories><build><plugins><plugin><groupId>com.pvsstudio</groupId><artifactId>pvsstudio-maven-plugin</artifactId><version>{VERSION_PVS_JAVA}</version><configuration><analyzer><outputType>text</outputType><outputFile>path/to/output.txt</outputFile>....</analyzer></configuration></plugin></plugins>
</build>

Before running the analysis you need to enter the license data:

在运行分析之前,您需要输入许可证数据:

mvn pvsstudio:pvsCredentials "-Dpvsstudio.username=USR" "-Dpvsstudio.serial=KEY"

After that, the license information will be saved in %APPDATA%/PVS-Studio-Java/PVS-Studio.lic on Windows or in ~/.config/PVS-Studio-Java/PVS-Studio.lic on macOS and Linux.

之后,许可证信息将保存在Windows上的%APPDATA%/ PVS-Studio-Java / PVS-Studio.lic或macOS和Linux上的〜/ .config / PVS-Studio-Java / PVS-Studio.lic中

After that you can run the analysis:

之后,您可以运行分析:

$ mvn pvsstudio:pvsAnalyze

In the block <analyzer> you can configure the analyzer. A list of all the settings can be found here.

在块<analyzer>中 ,可以配置分析仪。 可以在此处找到所有设置的列表。

Gradle插件 (Plugin for Gradle)

If the project you're working on is based on the Gradle build system, you can use the plugin pvsstudio-gradle-plugin. To do this, you need to add the following in the build.gradle file:

如果您正在处理的项目基于Gradle构建系统,则可以使用插件pvsstudio-gradle-plugin。 为此,您需要在build.gradle文件中添加以下内容:

buildscript {repositories {mavenCentral()maven {url uri('http://files.viva64.com/java/pvsstudio-maven-repository/')}}dependencies {classpath group: 'com.pvsstudio',name: 'pvsstudio-gradle-plugin',version: '{VERSION_PVS_JAVA}'}
}
apply plugin: com.pvsstudio.PvsStudioGradlePlugin
pvsstudio {outputType = 'text'outputFile = 'path/to/output.txt'....
}

Before running the analysis you need to enter the license data:

在运行分析之前,您需要输入许可证数据:

./gradlew pvsCredentials "-Ppvsstudio.username=USR" "-Ppvsstudio.serial=KEY"

After that, the license information will be saved in % APPDATA%/PVS-Studio-Java/PVS-Studio.lic on Windows OS or in ~/.config/PVS-Studio-Java/PVS-Studio.lic on macOS and Linux.

之后,许可证信息将保存在Windows OS上的%APPDATA%/ PVS-Studio-Java / PVS-Studio.lic中或MacOS和Linux上的〜/ .config / PVS-Studio-Java / PVS-Studio.lic中 。 。

After that you can run the analysis:

之后,您可以运行分析:

$ ./gradlew pvsAnalyze

In the block 'pvsstudio' you can configure the analyzer. A list of all settings can be found here.

在“ pvsstudio”块中,您可以配置分析仪。 可以在此处找到所有设置的列表。

IntelliJ IDEA的插件 (Plugin for IntelliJ IDEA)

The PVS-Studio Java analyzer can be also used as a plugin for IntelliJ IDEA. In this case, the parsing of the project structure is made by means of this IDE and the plugin provides a convenient graphic interface to work with the analyzer.

PVS-Studio Java分析器也可以用作IntelliJ IDEA的插件。 在这种情况下,项目结构的解析是通过此IDE进行的,并且插件提供了一个方便的图形界面来与分析仪一起使用。

The PVS-Studio plugin for IDEA can be installed:

可以安装IDEA的PVS-Studio插件:

  • from the official repository of JetBrains plugins;

    来自JetBrains插件的官方仓库 ;

  • from the repository on the viva64.com site;

    从viva64.com网站上的存储库中;
  • via the PVS-Studio installer for Windows, available on the download page.

    通过适用于Windows的PVS-Studio安装程序,可在下载页面上找到 。

Once you installed the plugin, you need to enter the license data:

安装插件后,您需要输入许可证数据:

1) Analyze -> PVS-Studio -> Settings

1)分析-> PVS-Studio->设置

Picture 26

2) Registration tab:

2)注册标签:

Picture 28

You can then run the analysis of the current project:

然后,您可以运行当前项目的分析:

Picture 30

发牌 (Licensing)

The PVS-Studio analyzer is meant for teams of developers and essentially represents a proprietary B2B product. To play around with all analyzer abilities, you can request a trial key.

PVS-Studio分析仪适用于开发人员团队,实质上代表了专有的B2B产品。 要使用所有分析仪功能,您可以请求一个试用密钥 。

If you are developing open projects, or for example, you are a student, then you can use one of the free licensing options of PVS-Studio.

如果您正在开发开放项目,或者例如,您是学生,则可以使用PVS-Studio的免费许可选项之一。

误报抑制 (False Positives Suppression)

To fight against false positives, the analyzer provides a set of different mechanisms.

为了对抗误报,分析仪提供了一组不同的机制。

1. Using special comments in the code:

1.在代码中使用特殊注释:

void f() {int x = 01000; //-V6061
}

2. Using the suppress file.

2.使用禁止文件 。

3. Using the @SuppressWarnings(....) annotations.

3.使用@SuppressWarnings(....)批注。

The analyzer is aware of annotations and might not issue warnings on the code that has already been marked. For example:

分析器知道注释,并且可能不会对已标记的代码发出警告。 例如:

@SuppressWarnings("OctalInteger")
void f() {int x = 01000;
}

结论 (Conclusion)

What we've just looked at is only a small part of what could be told. For example, it's also possible to integrate with SonarQube and much more. PVS-Studio Java is a new direction that is actively developing:

我们刚刚看到的只是可以告诉的一小部分。 例如,还可以与SonarQube等集成。 PVS-Studio Java是正在积极开发的新方向:

  • new functionality is added,

    添加了新功能,
  • abilities are expanding,

    能力在扩大,
  • diagnostic rules are added and improved,

    诊断规则已添加和改进,
  • and much more.

    以及更多。

To fully explore the existing analyzer abilities and not to miss the emergence of new ones in future, follow the PVS-Studio blog.

要充分利用现有的分析仪功能,并且将来不要错过新的分析仪功能,请关注PVS-Studio 博客 。

翻译自: https://habr.com/en/company/pvs-studio/blog/462267/

pvs-stdio ue4


http://chatgpt.dhexx.cn/article/wQgmGtq4.shtml

相关文章

pvs-stdio ue4_在Windows OS上检查虚幻引擎项目时的PVS-Studio使用情况

pvs-stdio ue4 This article focuses on the specifics of checking Unreal Engine projects with the PVS-Studio static analyser on the Windows operating system: how to install the analyser, check a project, where and how to view an error report. 本文重点介绍在W…

周志华与「深度森林」

关注网易智能&#xff0c;聚焦AI大事件&#xff0c;读懂下一个大时代&#xff01; 近日于深圳举办的2018中国人工智能大会上&#xff0c;AI领域的顶级大牛、南京大学人工智能学院院长、ACM/AAAI/IEEE Fellow周志华发表了演讲&#xff0c;并在会后接受了网易智能等媒体的采访&am…

深度森林:探索深度神经网络以外的方法

挑战深度学习 《深度森林&#xff1a;探索深度神经网络以外的方法》 阅读量&#xff1a; 1306 收藏本文 深度神经网络的巨大成功掀起了一股深度学习热潮。 或许&#xff0c;这股热潮有些“太热”了。 就在这周&#xff0c;南京大学机器学习与数据挖掘研究所&#xff08;LAMDA&a…

【深度森林算法实践】分类与回归

1 Review&#x1f496; 不可否认&#xff0c;深度森林的提出很大程度是受深度学习算法启发。现如今&#xff0c;深度学习算法在诸多领域都展示出了傲人的实力&#xff0c;周志华教授作为国内集成学习领域的先驱&#xff0c;则在借鉴了深度学习算法结构的基础上&#xff0c;提出…

深度——强化学习、深度森林

Sutton’sTD&#xff08;0&#xff09;算法&#xff1a;考虑当前回报和下一状态的估计值&#xff0c;它的更新公式 &#xff1a; • Q-learing算法&#xff1a;它和Sutton’sTD(0)算法类似&#xff0c;只是将动作集A也考虑进来。 定义动作价值函数Q&#xff08;s,a&#xff09;…

周志华团队和蚂蚁金服合作:用分布式深度森林算法检测套现欺诈

翻译 | 林椿眄 出品 | AI科技大本营&#xff08;公众号ID&#xff1a;rgznai100&#xff09; 【AI科技大本营导读】 互联网公司每天都面临着处理大规模机器学习应用程序的问题&#xff0c;因此我们需要一个可以处理这种超大规模的日常任务的分布式系统。最近&#xff0c;以…

在Python 3中使用深度森林(Deep Forest)进行分类

深度森林(Deep Forest)是周志华教授和冯霁博士在2017年2月28日发表的论文《Deep Forest: Towards An Alternative to Deep Neural Networks》中提出来的一种新的可以与深度神经网络相媲美的基于树的模型&#xff0c;其结构如图所示。 gcForest.png 文中提出的多粒度级联森林(Mu…

9大数据集6大度量指标完胜,周志华等提出深度森林处理多标签学习

2019-11-25 11:01:57 选自arXiv 机器之心编译参与&#xff1a;路雪、一鸣 近日&#xff0c;南大周志华等人首次提出使用深度森林方法解决多标签学习任务。该方法在 9 个基准数据集、6 个多标签度量指标上实现了最优性能。 在多标签学习中&#xff0c;每个实例都有多个标签&am…

深度森林DF21、deep forest、gcForest

文章目录 DF21的优势DF21的可以用来干什么对标算法[^1] DF21的优势 DF21是周志华团队于2021年2月1日推出的深度森林开源库&#xff0c;其优势在于超参少、训练效率高1。 DF21的可以用来干什么 DF21可以用来进行分类和回归2。 对标算法2 搜狐自媒体网文&#xff1a;周志华团…

如何评价周志华深度森林模型

这篇文章背后的思路实际上是这样的&#xff1a; DNN&#xff08;或者说 MLP&#xff09;其实就是堆起来的广义线性模型&#xff08;比如 logistic&#xff0c;但也有其他激活函数&#xff09;。它能够自动发现特征与标签之间的非线性关系&#xff0c;当决策边界非线性&#xf…

gcForest分布式深度森林及其在套现欺诈自动检测中的应用

分布式深度森林及其在套现欺诈自动检测中的应用 摘要 互联网企业每天面对处理大规模机器学习应用的请求,需要一个能够处理超大数据任务的分布式系统.深度森林是最近提出的一个利用树作为组件深度学习框架,在各种领域取得不错的结果.然而并没有在超大规模数据任务上测试.在这项…

【论文解读】关于深度森林的一点理解

2017年年初&#xff0c;南京大学周志华老师上传了一篇名为&#xff1a;Deep Forest&#xff1a;Towards An Alternative to Deep Neural Networks的论文&#xff0c;一石激起千层浪&#xff0c;各大媒体纷纷讨论着&#xff0c;这似乎意味着机器学习的天色要变&#xff0c;实则不…

随机森林算法的扩展-深度森林(deep forest)

深度学习最大的贡献&#xff0c;个人认为就是表征学习&#xff08;representation learning&#xff09;&#xff0c;通过端到端的训练&#xff0c;发现更好的features&#xff0c;而后面用于分类&#xff08;或其他任务&#xff09;的输出function&#xff0c;往往也只是普通的…

多标签学习与深度森林学习笔记

周志华老师团队Multi-Label Learning with Deep Forest (MLDF)报道很多&#xff0c;各大机器学习平台也都就这篇文章的亮点给出了分析。近日在准备组会报告时较为详细地拜读了一下&#xff0c;也由此简单了解了一下多标签学习的相关内容。 正如论文作者所述&#xff0c;MLDF的…

论文阅读:Deep forest/深度森林/gcForest

最近组会汇报了这篇文章&#xff0c;简单把思想梳理下来了&#xff0c;对了搜索深度森林的时候可能会看到Deep Forest: Towards an Alternative to Deep Neural Networks&#xff0c;这两篇文章的内容基本上是一致的&#xff0c;只在叙述方面有一些很小的不同。 下面是我做的p…

【冰糖Python】深度森林 DeepForest

此文为记录DeepForest的简单使用 原文《Deep Forest: Towards an Alternative to Deep Neural Networks》 “A key advantage of deep forest is its adaptive model complexity depending on the dataset. The default setting on hyper-parameters enables it to perform r…

使用深度森林(Deep Forest)进行分类-Python

一、什么是深度森林&#xff1f; 传统DNN的不足&#xff1a; 1、需要大量的数据集来训练&#xff1b; 2、DNN的模型太复杂&#xff1b; 3、DNN有着太多的超参数 gcForest的优势&#xff1a; 1、更容易训练&#xff1b; 2、性能更佳&#xff1b; 3、效率高且可扩展、支持…

深度森林浅析

深度森林 深度学习最大的贡献是表征学习&#xff08;representation learning&#xff09;&#xff0c;通过端到端的训练&#xff0c;发现更好的features&#xff0c;而后面用于分类&#xff08;或其他任务&#xff09;的输出function&#xff0c;往往也只是普通的softmax&…

深度森林原理及实现

目录 背景 级联森林 多粒度扫描 代码 总结 背景 深度森林(Deep Forest)是周志华教授和冯霁博士在2017年2月28日发表的论文《Deep Forest: Towards An Alternative to Deep Neural Networks》中提出来的一种新的可以与深度神经网络相媲美的基于树的模型&#xff0c;其结构…

论文阅读:深度森林

论文地址&#xff1a;https://arxiv.org/pdf/1702.08835.pdf 相关代码&#xff1a;https://github.com/kingfengji/gcForest 深度森林是南大周志华老师前两年提出的一种基于随机森林的深度学习模型。 当前的深度学习模型大多基于深度学习神经网络&#xff08;DNN&#xff09;…