首页 > 解决方案 > Linux 上的 PVS Studio - 命令行返回码

问题描述

Windows 命令行的官方文档非常清楚 - 返回代码是一个位掩码,每个位都意味着什么,特别是代码“256”表示“在源代码中发现了一些问题”。

对于 Linux 命令行操作,我可以通过以下方式获取此帮助信息pvs-studio-analyzer --help

pvs-studio-analyzer state codes that form a bit mask exit code are:
  0 - Analysis was successfully completed, no issues
      were found in the source code;
  1 - Preprocessing failed on some file(s);
  2 - Indicates that analyzer license will expire in
      less than a month;
  3 - Analysis was interrupted;
  4 - Error (crash) during analysis of some source file(s);
  5 - Indicates that analyzer license has expired;
  6 - License expiration warning suppression flag was used
      with non-expiring license;

首先,这些代码不能形成有效的位掩码,它们不是 2 的幂!
其次,没有特定的返回码表示“在源代码中发现了一些问题”,我对此特别感兴趣——因此没有明显的方法来检查是否发现了任何问题(并以某种方式对其作出反应)。

第三,我在官方文档中找不到任何关于 Linux 上的返回码的信息。

所以,我的问题是 - 这个帮助信息正确吗?如果是,我如何检查是否发现了任何问题?

标签: pvs-studio

解决方案


Linux 和 macOS的pvs-studio-analyzer实用程序确实不会返回位掩码。我们修复了描述。

要检测报告中存在警告的情况,请使用该plog-converter实用程序:

plog-converter ... --indicate-warnings ...

-w,--指示警告。通过将转换器退出代码设置为“2”,设置此选项以在过滤分析日志后检测分析器警告的存在。


推荐阅读