【问题标题】:PVS Studio on Linux - command line return codesLinux 上的 PVS Studio - 命令行返回码
【发布时间】:2020-02-04 05:08:06
【问题描述】:

Windows 命令行的Official documentation 非常清楚 - 返回码是位掩码,每个位都表示某种含义,特别是,代码“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


    【解决方案1】:

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

    要在报告中有警告时检测案例,请使用plog-converter 实用程序:

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

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

    【讨论】:

    • 澄清一下:如果 plog-converter 输出格式为 errorfile - 所有问题都将是“错误”或也有“警告”?
    • @Amomum, errorfile 是报告类型。您必须传递 --analyzer 参数才能设置警告级别(错误、警告、注意)。
    • 所以只能有错误或只有警告或只有注释?
    • 没有。例如-a "GA:1,2,3"。您可以组合关卡。
    • 哦,好的。所以--indicate-warnings 将返回退出代码2 如果有任何级别的问题或只是为了警告?
    猜你喜欢
    • 2018-06-08
    • 2019-02-02
    • 2019-09-26
    • 1970-01-01
    • 2017-01-21
    • 1970-01-01
    • 1970-01-01
    • 2021-04-04
    • 1970-01-01
    相关资源
    最近更新 更多