abap-cleaner icon indicating copy to clipboard operation
abap-cleaner copied to clipboard

CLI flag `--check-only`

Open bnichell opened this issue 1 year ago • 2 comments

Currently the CLI tool only allows to change the source files directly based on the given rules. For code review purposes I propose a --check-only CLI flag, that only reports the findings without changing the checked files.

bnichell avatar Mar 05 '24 09:03 bnichell

Hi Benedikt,

nice idea – what kind of reporting of findings would you expect? Currently, there are options for summarized output …

    --stats             Write statistical summary to standard output.
    --usedrules         Write list of used rules to standard output.

… but I wonder whether you would also want a list of concrete findings, e.g. "[<source file><TAB>]<line number><TAB><to-be-used rule>"? This would then be a bit like the output of ATC (and possibly get longer than the actual code ;-)

15     Remove space before commas and period
32     Simplify a chain with one element
36     Convert upper and lower case
36     Use CamelCase for known CDS names
42     Align declarations
...

Kind regards, Jörg-Michael

jmgrassau avatar Mar 29 '24 08:03 jmgrassau

Hi Jörg-Michael,

the flag requested here should only have an effect on whether or not the analyzed files are being changed. With the flag active, the checked files should only be analyzed and not be changed (read-only). The result should be returned to stdout in both cases (not sure if an additional flag makes sense to log the result additionally to a file, as this could be easily achieved by redirecting the output). Combined with the alternative output formats requested in #263, the result output could be easily parsed, and the formatting state could be easily checked in e.g. CI without actually changing any files.

Cheers, Benedikt

bnichell avatar Apr 04 '24 22:04 bnichell