pvs-studio

PVS Studio on Linux - command line return codes


Official documentation for Windows command line is quite clear - return code is a bit mask, every bit means something and, particularly, code '256' means 'some issues were found in the source code'.

For the Linux command line operation I can get this help message wih 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;

First of all, these codes can not form a valid bit mask, they are not powers of 2!
Secondly, there is no specific return code meaning "some issues were found in the source code" in which I'm particularly interested - so there is no obvious way to check if any issues were found (and react to it somehow).

Thirdly, I could not find anything about return codes on Linux in official documentation.

So, my question is - is this help message correct? And if it is, how can I check if any issues were found?


Solution

  • The pvs-studio-analyzer utility for Linux and macOS really doesn't return a bit mask. We fixed the description.

    To detect cases when there are warnings in the report, use the plog-converter utility:

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

    -w, --indicate-warnings. Set this option to detect the presense of analyzer warnings after filtering analysis log by setting the converter exit code to '2'.