-
Notifications
You must be signed in to change notification settings - Fork 1.7k
When two conflicting lint rules are enabled, consider not reporting lint from either one #58087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @dvorapa. Could you share your analysis options ( |
|
I'm sorry for the frustration this is causing you. It's true that The role of the linter is not to enforce a single universal coding style. It's to allow users to automate enforcement of some aspects of the coding style they have chosen. If some users want to always use That means that you can't enable all of the rules, but instead need to decide for yourself which rules match the style you want to enforce, just as you did for the two quote related lints.
What concerns me, though, is why this only happened after upgrading flutter. Did you explicitly change the analysis options file as part of that process? Did flutter upgrade change it for you? If the file wasn't changed, then it's possible that we fixed a bug in one rule or the other that caused them to start behaving this way. (I haven't checked to see whether that's the case.) |
I haven't changed the file, it is the same as it was in Dart 2.5.0/Flutter 1.9.6. If these two (4 if you count single/double quotes) are one-or-another (depends on the programmer choice), this should be explicitly written in the linter docs. Also I would consider add sections into the full list here, like this (example):
|
Would it make sense for the analyzer to warn if you have two mutually exclusive/incompatible lints enabled? The analyzer/linter would have to have some sort of list of counter-indications for each lint, but I guess that could be a fairly sparse map to maintain. Then, if you have both "prefer_single_quotes" and "prefer_double_quotes" enabled, you would not get warnings about string quotes (effectively disabling both lints), but you would get a general warning about incompatible lints being enabled, so you can fix that. |
Actually there are already some informations available on each lint rule about conflicting rules - for instance see https://github.com/dart-lang/linter/blob/186b6c5099accd0e179594445d9d67409249b7ab/lib/src/rules/unnecessary_final.dart#L47-L48 |
As @a14n point out, there is some support for reporting incompatibilities. For example, this is what you'd see in IDEA (With a similar warning produced by the CLI.)
This though we don't do and it's an interesting idea. /fyi @bwilkerson |
Describe the issue
After upgrade to new Flutter stable (1.12.13), I got multiple unnecessary_final warnings. But when I remove these, I get similar amount of prefer_final_locals. What should I do? This definitely looks like a bug.
Expected behavior
There should not be any conflicting warnings.
Additional context
Dart 2.7.0, Flutter 1.12.13
The text was updated successfully, but these errors were encountered: