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

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插件:

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

工具:PVS-Studio使用 阅读详情

相关推荐

PVS-Studio 5.13 破解

PVS-Studio 5.13 破解版 静态测试工具

PVS-Studio Crack,重新编译后的自动分析

静态分析的主要价值在于它的定期使用,以便在最早的阶段识别和修复错误。所以,让我们再次指出——静态分析的主要思想不是在发布前一天发现一个隐藏的bug,而是日复一日地修复几十个bug。该工具允许您向开发人员发送关于PVS Studio在夜间运行中发现的错误的电子邮件通知。PVS Studio窗口中分析结果(日志文件)的交互式筛选:通过诊断编号、文件名和诊断文本中的关键字。保存和加载分析结果可以在夜间进行检查-分析仪在夜间进行扫描,并在早上为您提供结果。您可以将分析结果保存为具有完整源代码导航功能的HTML。

q2315702359的博客 516

PVS Studio v4.14 注册版

PVS Studio v4.14 注册版 PVS-Studio Static Code Analyzer for C/C++/C++0x 是visual studio 的插件,可用于代码质量分析,帮助你改进你的代码

PVS Studio 7.30.81740.1020

PVS-Studio 执行静态代码分析并生成报告,帮助程序员查找和修复错误。PVS-Studio 执行广泛的代码检查,它还有助于搜索印刷错误和复制粘贴错误。此类错误的示例:V501、V517、V522、V523、V3001。

控件与插件之大全 907

SD--根据订单创建出库单(相关的函数列表的介绍系列篇(2))

创建订单样例代码参见:http://blog.csdn.net/CompassButton/archive/2007/05/09/1601712.aspx 可以根据一个订单或者部分订单项来创建出库单,代码如下:* Populating the item data lx_sales_item-ref_doc = l_vbeln. lx_sales_item-ref_item = c_000010

SAP BLOG--Jack Wu 6236

格拉姆角场(GAF)实战:用Python实现时间序列图像化处理

本文深入解析了格拉姆角场(GAF)技术,这是一种将一维时间序列转化为二维图像特征的方法,以便利用卷积神经网络(CNN)等图像模型进行深度分析。文章通过Python实战代码,详细演示了GASF和GADF两种核心转换的实现过程,并探讨了其在时序数据分类任务中的应用,为故障预警、金融模式识别等场景提供了强大的图像驱动分析视角。

weixin_29079671的博客 278

代码检测工具——PVS-Studio Analyzer

下载地址:https://www.viva64.com/en/pvs-studio/ 激活码: 用户:Ru.Board 密码:UX9G-38X9-1HNH-0B0F0 执行如下命令可以激活: pvs-studio-analyzer credentials Ru.Board UX9G-38X9-1HNH-OBOF 今天刚用,也只会用一点点。 写了一个脚本进行使用(pvs.sh)...

IT8343的博客 3001

SECS/GEM协议学习教程

摘要:SECS/GEM是半导体制造设备通信的国际标准,定义了主机系统与设备间的通信规范,包括设备控制、状态监控、数据采集等功能。协议采用分层架构(应用层、消息层、传输层、物理层),支持关键消息类型如S1F13(建立通信)、S2F13(数据采集)等。通信流程涵盖建立连接、数据交换和终止会话,并通过状态变量(SVID)、事件(CEID)等实现实时交互。典型应用包括设备初始化、报警处理及配方管理,需处理数据类型(如U2、A、L)和通信调试问题。

GitHub个人仓库地址:https://github.com/feiyuluoye ; 个人塔罗牌占卜平台:http://118.126.82.12:8080/ ; 欢迎广大Coding友共同交流讨论。 2086

pvs-stdio ue4_用于Visual Studio的PVS-Studio

pvs-stdio ue4 Many of our articles are focused on anything, but not the PVS-Studio tool itself. Whereas we do a lot to make its usage convenient for developers. Nevertheless, our efforts are often co...

cullen2012的博客 1042

uniapp实战:mui-player插件如何完美适配m3u8/flv直播流(附完整代码)

本文详细介绍了如何在Uniapp中使用mui-player插件完美适配m3u8和flv直播流,提供从基础配置到高级优化的全流程解决方案。通过动态加载策略、响应式布局和内存管理,实现跨平台稳定播放,适用于企业级直播应用开发。

weixin_29001655的博客 239

MTK平台LCD驱动开发实战:从零开始点亮你的Android屏幕

本文详细介绍了在MTK平台进行Android LCD驱动开发的完整流程。从理解LK与Kernel双核驱动框架入手,手把手讲解驱动结构体、屏幕参数配置、初始化序列编写以及PLL_CLOCK计算等核心步骤,并提供了系统集成配置与实用的调试避坑指南,帮助开发者高效点亮新屏幕。

terraform7cloud的博客 298

pvs-stdio ue4_华为云:如今PVS-Studio多云

pvs-stdio ue4 Nowadays everyone knows about cloud services. Many companies have cracked this market segment and created their own cloud services of various purposes. Recently our team has also been i...

cullen2012的博客 524

麒麟系统无法进入单用户模式该怎么办?

🏆本文收录于《全栈Bug调优(实战版)》专栏,主要记录项目实战过程中所遇到的Bug或因后果及提供真实有效的解决方案,希望能够助你一臂之力,帮你早日登顶实现财富自由🚀;同时,欢迎大家关注&&收藏&&订阅!持续更新中,up!up!up!! 备注:部分问题/疑难杂症搜集于互联网。

**My Coding Family** 1823

PVS-Studio C/C++/C++11 静态代码分析工具

PVS-Studio C/C++/C++11 静态代码分析工具 静态代码分析仪是一种检测代码缺陷、分析对比 商业代码的工具,它分析源代码和它生成的目标 文件,但并不实际运行源代码。应用于对安全性、 稳定性要求很高的领域,比如航天、国防、工业 控制、金融等就需要严格的代码分析工具。 PVS-Studio 能发现代码中一些潜在问题,或者 针对某些潜在问题给出警告。   PVS-St

痞子龙3D编程 3322

Qt代码-无人机地面站系统

无人机地面站系统是无人机与操作员交互的核心枢纽,需实现**无人机状态监控**(位置、姿态、电池等)、**实时通信**(基于MAVLink协议)、**任务规划**(航点编辑、航线生成)、**地图显示**(无人机位置与航迹)、**参数配置**(传感器校准、飞行模式设置)等核心功能。地面站作为`MAV_COMP_ID_GCS`(地面控制站组件ID=255),无人机通常为`MAV_COMP_ID_AUTOPILOT1`(组件ID=1)。// 航点/盘旋指令。// 北京坐标(示例)

寒寒豆豆软件公司的博客 329

pnpm 卸载教程:彻底移除 pnpm 及全局缓存的方法

卸载 pnpm = 全局包 → CLI → 环境变量 → store 缓存只要按这个顺序来,基本不会留下任何坑。如果你后面还打算重新安装 pnpm / 切换 npm、yarn / 多包管理器共存,这些细节反而更重要,环境一旦干净,后续问题会少很多。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 955

C++代码静态检测

C++代码静态检测一,CppCheck(下载地址:http://cppcheck.net/)1,使用CppCheck客户端检测2,在vs中使用CppCheck二,TscanCode(下载地址:https://github.com/Tencent/TscanCode)三,PVS-studio(下载地址:https://www.viva64.com/en/pvs-studio/)1,安装2,破解3,使...

bajianxiaofendui的博客 1万+

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

pvs linux_Linux下用于C ++开发的PVS-Studio静态分析器入门

pvs linuxPVS-Studio supports analyzing projects developed in C, C++, C#, and Java. You can use the analyzer under Windows, Linux, and macOS. This small article will tell you the basics of analyzing C ...

cullen2012的博客 997

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

pvs-stdio ue4_PVS-Studio:进步的引擎

pvs-stdio ue4 A PVS-Studio team and our product make a great contribution to upgrading of software quality. Moreover, in addition to detecting errors in closed and open source projects, there is an i...

cullen2012的博客 395

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

PVS-Studio 静态代码分析工具推荐

PVS-Studio是一种静态代码分析工具,用于诊断C / C++/ C+11应用程序源代码中的错误。

johnsonlee86的专栏 4216

pvs-stdio ue4_云中的PVS-Studio —在Travis CI上运行分析

pvs-stdio ue4 Why do we consider third-party clouds and don't make our own? There is a number of reasons, the main one is that the SaaS implementation is quite an expensive and difficult procedure. I...

cullen2012的博客 747

来自俄罗斯的源代码分析工具 PVS-Studio

PVS - Studio 工具由俄罗斯 OOO "Program Verification Systems" 公司开发。 官方网站:http://www.viva64.com/en/pvs-studio/ PVS-Studio静态代码分析工具作为一种工具来检测代码中的缺陷和商业代码分析对比。越来越多的领域依赖计算机,代码的质量就成了关键。比如航天、国防、工业控制、金融等对安全性,稳定性要求很高的领

软件质量优化 6088

pvs-stdio ue4_PlatformIO中的PVS-Studio集成

pvs-stdio ue4 Recently, the PlatformIO development environment of embedded systems has supported PVS-Studio. In this article, you'll find out how to check your code with the static analyzer on the ex...

cullen2012的博客 769

代码静态分析工具

在大型代码工程中,通常使用 Coverity 和 SonarQube 这样的工具,它们能够集成到持续集成/持续部署(CI/CD)流水线中,自动分析每次提交的代码变化,提供可视化报告,帮助开发团队及时发现和修复问题。PVS-Studio:另一种静态分析工具,支持多种编程语言(如C、C++、C#、Java),能查找编码错误和潜在的安全漏洞。静态分析是指在不运行程序的情况下,通过检查代码文本来发现潜在的问题或优化建议。通过这些工具和方法,可以在代码开发的早期发现潜在的问题,提高代码质量,减少错误发生的可能性。

jjjxxxhhh123的博客 2107

pvs-stdio ue4_PVS-Studio对牛顿游戏动力学的第二次检查

pvs-stdio ue4 Some time ago, somewhere on the Internet, I stumbled upon a physics engine called Newton Game Dynamics. Knowing that engine projects are usually big and complex, I decided to check its ...

cullen2012的博客 1330

pvs-stdio ue4_PVS-Studio –用于C,C ++,C#和Java的静态代码分析器

pvs-stdio ue4What’s the one most required thing while writing a C or C++ or for that matter any other computer program? 编写C或C ++或其他任何计算机程序时最需要做的一件事是什么? Yes it’s the compiler, how else your machine w...

culing2941的博客 591
上一篇: 集成电路静态时序分析与建模_静态分析:从入门到集成
下一篇: 如何生成具有洗钱模式的巨大金融图?
cullen2012
博客等级 码龄11年 38粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值