linter icon indicating copy to clipboard operation
linter copied to clipboard

Don't label rules "stable" until they're in the stable release

Open Erhannis opened this issue 3 years ago • 5 comments

Describe the issue I see lint rules like https://dart-lang.github.io/linter/lints/discarded_futures.html with "Maturity: stable", but are not present in the stable release. (I spent like 2 hours trying to figure out why that rule wasn't working.)

I tested unawaited_futures, discarded_futures, combinators_ordering, and use_string_in_part_of_directives, all marked "stable". They were varyingly present in stable, beta, and master. Results:

unawaited_futures: stable, beta, master discarded_futures: beta, master combinators_ordering: master use_string_in_part_of_directives: master

To Reproduce

flutter channel stable
flutter upgrade
flutter analyze
(observe that some lints don't trigger when they should)
flutter channel master
flutter upgrade
flutter analyze
(observe that new lint rules work)

Expected behavior Lint rules should be marked with the stability level they're present in. If they're not in stable, they're not stable. If stable means something different in the documentation, they should be marked with a NEW label indicating which Dart/Flutter release they show up in. They show the linter version, atm, but I have found no way of associating that with a version of Dart or Flutter, nor even finding out which version of the linter I'm running.

Additional context (Separately, it might also be good if the linter showed a warning when it doesn't recognize a rule. Even figuring out whether it was TRYING to run the new rules took time.)

Erhannis avatar Aug 10 '22 01:08 Erhannis

@Erhannis thanks for filing an issue.

I see lint rules like https://dart-lang.github.io/linter/lints/discarded_futures.html with "Maturity: stable", but are not present in the stable release.

The linter package doesn't have stable releases. That rule is found in release 1.25.0, fwiw.

The label "Maturity: stable" means the lint rule's maturity is declared to be "stable," not that it is in a stable release of some product or other.

I tested unawaited_futures, discarded_futures, combinators_ordering, and use_string_in_part_of_directives, all marked "stable". They were varyingly present in stable, beta, and master.

The linter does not have "stable" or "beta" or "master" releases.

They show the linter version, atm, but I have found no way of associating that with a version of Dart or Flutter, nor even finding out which version of the linter I'm running.

The Dart CHANGELOG shows which version of linter is included. Each lint rule's page lists which version of linter it was first released with (https://dart-lang.github.io/linter/lints/discarded_futures.html).

srawlins avatar Aug 10 '22 04:08 srawlins

It still seems excessively difficult to figure out whether you can use a given lint rule or not. Like I said, it took me two hours. In the future, KNOWING these things, I expect I'll be able to follow the chain of info in much less time, but the linter is a pretty integral part of the Dart ecosystem, and for the docs to pretend it stands on its own seems unhelpful to me. Likely 99% of the people who visit the docs use the linter that comes with their stable release of Flutter, so for the docs to say "Maturity: stable" leads them erroneously to believe they're able to use those rules, and the linter itself apparently doesn't tell them otherwise when they try; it just silently ignores the newer rules. This combination of confusing things seems problematic to me.

On Wed, Aug 10, 2022, 12:26 AM Sam Rawlins @.***> wrote:

@Erhannis https://github.com/Erhannis thanks for filing an issue.

I see lint rules like https://dart-lang.github.io/linter/lints/discarded_futures.html with "Maturity: stable", but are not present in the stable release.

The linter package doesn't have stable releases. That rule is found in release 1.25.0, fwiw.

The label "Maturity: stable" means the lint rule's maturity is declared to be "stable," not that it is in a stable release of some product or other.

I tested unawaited_futures, discarded_futures, combinators_ordering, and use_string_in_part_of_directives, all marked "stable". They were varyingly present in stable, beta, and master.

The linter does not have "stable" or "beta" or "master" releases.

They show the linter version, atm, but I have found no way of associating that with a version of Dart or Flutter, nor even finding out which version of the linter I'm running.

The Dart CHANGELOG https://github.com/dart-lang/sdk/blob/master/CHANGELOG.md shows which version of linter is included. Each lint rule's page lists which version of linter it was first released with ( https://dart-lang.github.io/linter/lints/discarded_futures.html).

— Reply to this email directly, view it on GitHub https://github.com/dart-lang/linter/issues/3590#issuecomment-1210145141, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXCNTNUITJ5OCSR4JDO4Y3VYMVQBANCNFSM56CXEQDQ . You are receiving this because you were mentioned.Message ID: @.***>

Erhannis avatar Aug 10 '22 06:08 Erhannis

It still seems excessively difficult to figure out whether you can use a given lint rule or not.

That's fair. I think it is a separate issue from how we label lint rules.

and the linter itself apparently doesn't tell them otherwise when they try; it just silently ignores the newer rules.

There is a diagnostic reported when you included an unknown rule name in analysis_options.yaml:

linter:
  rules:
    - bad

I see in my IDE:

'bad' is not a recognized lint rule.

If you don't see this diagnostic, please file a bug.

srawlins avatar Aug 10 '22 16:08 srawlins

My analysis_options.yaml had some rules in there already, in the format

linter:
  rules:
    combinators_ordering: true

This does not give an unknown-rule warning. But rewriting it as

linter:
  rules:
    - combinators_ordering

does give such a warning. Is that a bug? (Note, it seems like you can't mix the two forms, and I don't know how to make the "-" form disable a rule.)

Erhannis avatar Aug 11 '22 18:08 Erhannis

Yes, that's a bug.

No, you can't mix the two forms. That's a limitation of YAML.

No, there's no way to disable a rule using the list (-) form.

bwilkerson avatar Aug 11 '22 18:08 bwilkerson

@Erhannis: sorry to hear this tripped you up. As it happens, this used to be a bit better (at least aspirationally). Until recently, we tried to provide a lower bound Dart SDK but that was buggy and I disabled it (https://github.com/dart-lang/linter/issues/2824). With a bit of effort we could bring it back (and likely should add support for Flutter SDK awareness too).

pq avatar Aug 16 '22 00:08 pq

This is resolved.

srawlins avatar Sep 23 '22 18:09 srawlins