Customise reporting
Hey!
I'm trying out diff_cover in Github Actions. Github Actions supports annotations where If I in a job run print out something like
::warning file=my_file,line=2,title=Missing Coverage::Line XXX is missing coverage
I will get these in the job logs:
And in the Pull request view it will show this:
Which is very neat.
However right now, I need to use diif_cover to create a json and the parse that to print out the annotations. I think it would make sense to have it as an option in diff_cover, but to me it looks like there's no way to inject custom reporting.
I think this could be done either using a hook system like with violations or by letting users specify "--format" or something.
I can contribute the PR, just wanted to hear what way you think it should be implemented
Similar issue here. In the case of sqlfluff, it already has a native github annotations output format, but in the case where I'm using diff-quality --compare-branch origin/main --violations sqlfluff, I can't get the annotations for findings only.
I've seen multiple tools (sqlfluff, pylint, etc.), either directly or with plugins have a --format github or --format github-native or similar.
In this case, the format would look something like
::warning title=SQLFluff,file=path/to/file.sql,line=189,col=1,endLine=189,endColumn=9::LT02: Expected indent of 12 spaces. [layout.indent]
vs something like
path/to/file.sql:14: Unnecessary trailing whitespace.
I'm open to the idea. I'll take a look at a pr if one comes in. Sorry this issue must had gotten lost in the shuffle.
I also have this requirement, and have created #432 as an example of the report generator for this use case.
A hook / plugin system would be cool - the logic does not feel very extendable right now.
Hi - seems like #432 resolved this for diff-cover, but the line level output for certain findings (at least with sqlfluff) still doesn't work exactly as expected with diff-quality.
For example:
diff-quality --compare-branch origin/main --format github-annotations:warnings --violations sqlfluff
some/dir/foo.sql (87.6%):
some/dir/foo.sql:169: Keywords should not be used as identifiers.
some/dir/foo.sql:341: Joins should list the table referenced earlier first.
In that case, also, presumably one would want to be able to have both warnings and errors indicated (just with a different prefix), so not sure what --format github-annotations:warnings would do in that case -- would it include both errors and warnings, or only one or the other?
See example above, but basically like:
::warning file=some/dir/foo.sql,line=169,col=5::Keywords should not be used as identifiers.
::error file=some/dir/foo.sql,line=341,col=15::Joins should list the table referenced earlier first.