Page MenuHomePhabricator

Multiple linters affecting same line, one of which applying autocorrect
Closed, DuplicatePublic

Description

Hi,

I'm running into an issue where we have multiple linters complaining about the same line of code.
Assume two linters (L-1 and L-2) affecting code line X

  1. L-1 and L-2 are run on code line X. Both fail. L-1 is an autofix linter.
  2. L-1 marks a suggestion and I accept it.
  3. L-2 would no longer fail given the new code, but it is not re-run.

arc lint fails with a lint error from L-2

My expectation is that since the code no longer fails lint, it shouldn't fail lint.

Me brainstorming potential outcomes:

  1. Multiple linters complaining about the same thing is a configuration problem. I need to fix my configuration.
  2. If an autofix makes a change to line X, re-run all linters that failed on line X
  3. If an autofix makes a change to line X, re-run all linters that would have linted line X

Downside to #1 is a situation where you have multiple linters that share some rules (eg disallow trailing whitespace).
Downside to #2 is that it wouldn't catch an autofix which broke a different linter (that was otherwise succeeding). That definitely feels like a configuration problem though (conflicting linters)
Downside to #3 is the obvious performance penalty.

Event Timeline

nipunn updated the task description. (Show Details)
nipunn added projects: Lint, Restricted Project.
nipunn added subscribers: nipunn, jhurwitz, angie.

In the general case, this is impossible to resolve. Suppose that you had conflicting linter rules, such as one whiche enforced that files end with a newline character and another which enforces that files do not end with a newline character.

+1. I agree that conflicting rules are un-resolvable (and thus a configuration issue), but in this case, even consistent rules cause an issue.

Do we want to be optimistic that the rules from different linters might be consistent?
Or do we want to only support multiple linters when they are totally independent?

angie moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Dec 5 2015, 5:07 AM