r/programming • • 13d ago

Problem with concurrent linter fixes

https://jfmengels.net/concurrent-linter-fixes/
3 Upvotes

3 comments sorted by

1

u/Kwantuum 12d ago

I don't know that this warranted an entire article. Some automated fixes are mutually incompatible, which is made very obvious from the (well made) example at the beginning. Would have been a lot more interesting if it discussed a way to determine up front which fixes might be incompatible so that you can apply all compatible fixes at once before re-analyzing. Most rules can simply not conflict with one another so it's definitely a waste not to batch them.

1

u/somebodddy 23h ago

Seeing that there are no conflicts for the two fixes—solely in terms of editing range

Maybe checking conflicts on the editing ranges is not enough, then?

A linter should support lints with labels - pointers to relevant areas of the code. This is good for the error reporting too - instead of just telling the user that a function named average exists, the lint sscce/useAvailableUtils could have a label that points to the location of that function. Once you have that, the label can conflict with the primary target of the sscce/removeUnusedFunctions lint - and now that we have a proper conflict the tool can tell these two lints should not be fixed together.

An interactive fixer could utilize that and prompt and ask the user which of the two conflicting lints they want to fix.