Closed dennyjames closed 1 year ago
It's a great idea, but unfortunately I don't believe this would be possible with Checkstyle as a backend. Checkstyle doesn't officially support API tools, and operates by running on syntactically complete files on the FS. This means we can't just submit a partial file to it - even if we faked it we'd have to generate a fake file that was syntactically valid, and in the correct relative location on the FS. The other approach that comes to mind - just filtering for errors on the lines that have changed - isn't complete either, as that would mean side-effects (e.g. an import becoming invalid, or cyclometric complexity increasing in the function) would be missed.
Open to better suggestions on how to approach this - but I suspect you're going to be better to operate only on changed files, which is already supported.
Will close this - feel free to reopen if you've bright ideas on how to approach this, but 24h thought hasn't given me any further insights given our constraints.
It is great if there is a way to scan only changed lines. This will come handy when we work on a large files and quickly want to view checkstyle errors only on changed lines.