nilaway icon indicating copy to clipboard operation
nilaway copied to clipboard

Unchanged files with check annotations

Open KyleSanderson opened this issue 1 year ago • 3 comments

So we added nilaway to our github actions flow a couple weeks back (which is great - it makes zero sense why this isn't in the language as fatal). https://github.com/autobrr/autobrr/blob/aa6ac6d4db6ed5a2ba5fd8e3f9bead46674b3e42/.github/workflows/golang-linter.yml#L26

However, on every single PR it reports these Unchanged files with check annotations lines as seemingly a way to punish external to GitHub linters. Other tools seem to be able to change the reporter to github-pr-check from the default to work around the added layer of annoyance, however I'm not seeing such a capability with nilaway presently.

Thoughts, direction, approach, etc appreciated.

KyleSanderson avatar Dec 31 '23 21:12 KyleSanderson

I think this is the github actions' logic that has some heuristics that automatically picks up sentences that start with error:.

Seeing one of recent PRs from your repository it seems that it's working sort-of OK now (although it only picks up the first line, where NilAway actually reports the code paths to show the nilness flows)?

We can probably add another formatter to follow Github's workflow commands such that it looks better. But in the meantime you can pass -json to output all NilAway errors in JSON, parse it, and post-process the errors to follow githubs' workflow commands for better presentations.

(Of course, as always, PRs more than welcome!)

yuxincs avatar Jan 17 '24 18:01 yuxincs

Kind of sounds like there's nothing out of the box here and it's something that has to be built? I'm coming up short on finding something to parse the json format that this outputs.

KyleSanderson avatar Jan 20 '24 21:01 KyleSanderson

Yes, this has to be built (either as a separate formatter within NilAway, or a custom post-process script on your end).

Running NilAway with -json flag will instruct it to output the results in JSON format, and then you can post-process the output JSON in any way you want :) tools like jq may be handy, or you can write python (or any other language) scripts to do a post process.

yuxincs avatar Feb 16 '24 00:02 yuxincs