nilaway icon indicating copy to clipboard operation
nilaway copied to clipboard

Summary line after completion

Open ashmckenzie opened this issue 1 year ago • 4 comments

A lot of analysis tools produce a summary line at the completion which shows things like how many warnings, errors etc. I feel this would be a valuable addition to improve the UX for both running by a user or in CI.

Something along the lines of:

$ nilaway ./...
--snip--

100 file(s) scanned, 9 nil panic(s) detected

ashmckenzie avatar Nov 29 '23 22:11 ashmckenzie

@yuxincs, this is the feature I mentioned at https://github.com/uber-go/nilaway/pull/133#issuecomment-1832758956 🙂

ashmckenzie avatar Nov 29 '23 22:11 ashmckenzie

I can add this feature if you accept to add. @yuxincs

mrtztg avatar Dec 01 '23 19:12 mrtztg

Hey! this would be a nice feature!

The thing is the linter driver we are using for running NilAway as a standalone checker is from go/analysis (see https://github.com/uber-go/nilaway/blob/main/cmd/nilaway/main.go), and it actually takes control of the main function such that there's not much post-processing we can do (to print this summary line for example).

Maybe there are some hacky ways to make it possible (feel free to explore @mrtztg, if you're interested), but I'm leaning towards waiting for https://github.com/golang/go/issues/61324 to be available and we can use the general driver framework instead.

yuxincs avatar Dec 06 '23 17:12 yuxincs

@yuxincs, I started looking to add the functionality but found it difficult to control the timing and placement of the summary information because of the way go/analysis is wired up as you say.

ashmckenzie avatar Dec 06 '23 22:12 ashmckenzie