[go: nahoru, domu]

Skip to content
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

Enable more lints #91642

Merged
merged 1 commit into from
Oct 15, 2021
Merged

Enable more lints #91642

merged 1 commit into from
Oct 15, 2021

Conversation

Hixie
Copy link
Contributor
@Hixie Hixie commented Oct 11, 2021

This enables:

  • avoid_double_and_int_checks
  • avoid_js_rounded_ints
  • unsafe_html
  • use_setters_to_change_properties

It also fixes a few places where the lints were violated.

It does not enable avoid_catches_without_on_clauses or avoid_catching_errors but it does prepare us for a world where those lints have fewer false positives; see dart-lang/linter#3023 for details.

@flutter-dashboard flutter-dashboard bot added a: animation Animation APIs a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems d: examples Sample code and demos f: focus Focus traversal, gaining or losing focus f: gestures flutter/packages/flutter/gestures repository. f: routes Navigator, Router, and related APIs. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. f: integration_test The flutter/packages/integration_test plugin team Infra upgrades, team productivity, code health, technical debt. See also team: labels. tool Affects the "flutter" command-line tool. See also t: labels. labels Oct 11, 2021
@google-cla google-cla bot added the cla: yes label Oct 11, 2021
@Hixie Hixie marked this pull request as ready for review October 12, 2021 04:17
@Hixie Hixie requested a review from Piinks as a code owner October 12, 2021 04:17
@Hixie
Copy link
Contributor Author
Hixie commented Oct 12, 2021

cc @goderbauer here's another one! :-)

@goderbauer
Copy link
Member

Given all these ignores, I am not convinced that avoid_catches_without_on_clauses in its current state is a good fit for the framework. It seems to disallow a pattern that we actually want to encourage (enriching exceptions with additional information helpful for debugging).

Same with avoid_catching_errors (although it doesn't have as many false positives).

Scrolling through the PR, a saw maybe two cases where these two lints improved the code slightly, at the cost of 90+ ignores...

@Hixie
Copy link
Contributor Author
Hixie commented Oct 12, 2021

Roger, I'll mark it as blocked on dart-lang/linter#3023 and remove the ignores.

@Hixie Hixie force-pushed the lintify branch 2 times, most recently from 269ebd6 to a92511f Compare October 13, 2021 00:07
@Hixie
Copy link
Contributor Author
Hixie commented Oct 13, 2021

@goderbauer PTAL

@goderbauer
Copy link
Member

Same of the ignores for the now disabled avoid_catches_without_on_clauses are still there. Is that intentional? They'll get removed next time somebody does an "remove ignores that are not ignoring anything" clean-up. So probably best to just not introduce them?

@Hixie
Copy link
Contributor Author
Hixie commented Oct 13, 2021

They're intended to make turning on the lint easier when the lint is adjusted to remove the obvious false positives.

I wasn't aware we were doing "remove ignores that are not ignoring anything" clean-up, is that automated at all?

@goderbauer
Copy link
Member

Regarding automation: There was work underway to warn about ignores that are not ignoring anything to avoid getting them into the code base in the first place and to require clean-up when the underlying bug was fixed: dart-lang/sdk#35234. That has stalled, though.

@goderbauer
Copy link
Member

I would prefer submitting this without the currently unnecessary ignores. Who knows how long it will take to fix the false positives, but I also don't feel super strongly about this. So, LGTM.

Copy link
Member
@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This enables:

 - avoid_double_and_int_checks
 - avoid_js_rounded_ints
 - unsafe_html
 - use_setters_to_change_properties

It also fixes a few places where the lints were violated.

It does not enable `avoid_catches_without_on_clauses` or `avoid_catching_errors` but it does prepare us for a world where those lints have fewer false positives; see dart-lang/linter#3023 for details.
@Hixie
Copy link
Contributor Author
Hixie commented Oct 14, 2021

Ok, I've changed them to regular comments.

@fluttergithubbot fluttergithubbot merged commit 299d484 into flutter:master Oct 15, 2021
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: animation Animation APIs a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems d: examples Sample code and demos f: focus Focus traversal, gaining or losing focus f: gestures flutter/packages/flutter/gestures repository. f: integration_test The flutter/packages/integration_test plugin f: routes Navigator, Router, and related APIs. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels. tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants