#692 The command line return code can be misleading

release_5.0
closed
nobody
5
2013-10-17
2012-12-13
Flavien Huynh
No

The documentation states that the return code for the Main class is the number of errors found by CheckStyle:
http://checkstyle.sourceforge.net/apidocs/com/puppycrawl/tools/checkstyle/Main.html
So if 1138 problem were found, the return code is 1138.

But nonzero return codes don't mean that CheckStyle reached an abnormal termination point, on the contrary, it performed its duty as expected.
So I'd say that successfully processing the input files is a success.

On the other hand I understand that using a positive return code can be used to to stop a build for instance.

So return codes values could for example be:
0: No processing errors, no problems detected
1: Warning: No processing errors, problems detected (the number is not transmitted)
2: Error: Some files could generated parsing error(s)
3: Fatal: No files could be parsed

Which would help integrating CheckStyle better
For those who need the number of problems, the information can be deduced from the produced XML report.

Discussion

  • Roman Ivanov
    Roman Ivanov
    2013-10-17

    Hi Flavien Huynh, this request is in complete state, please start discussion in mail-list.

    I am not sure about:
    1: Warning: No processing errors, problems detected (the number is not transmitted)
    2: Error: Some files could generated parsing error(s)
    3: Fatal: No files could be parsed

    especially difference between 2 and 3 is so unclear some times , I doubt we could provide it.
    Please describe exact use case of intergation you are looking at.

     
  • Roman Ivanov
    Roman Ivanov
    2013-10-17

    • labels: return code --> return code, incomplete
     
  • Roman Ivanov
    Roman Ivanov
    2013-10-17

    • status: open --> closed