Skip to content

Integrate package:flutter_lints into templates - #81417

Merged
fluttergithubbot merged 19 commits into
flutter:masterfrom
goderbauer:lints
May 10, 2021
Merged

fluttergithubbot merged 19 commits into
flutter:masterfrom
goderbauer:lints

Conversation

@goderbauer

@goderbauer goderbauer commented Apr 28, 2021 •

Copy link
Copy Markdown
Member

Part of #78432.

This PR enables the recommended set of lints for Flutter apps and packages from package:flutter_lints for apps/packages/plugins created via flutter create. It also adapts those templates to ensure that they are analyzer clean under the new set of lints.

There's a bug in the linter wrt treatment of empty rules sections that is fixed upstream, but not rolled into the framework yet: dart-lang/sdk#58383

@flutter-dashboard flutter-dashboard Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 28, 2021
@google-cla google-cla Bot added the cla: yes label Apr 28, 2021
@goderbauer

Copy link
Copy Markdown
Member Author

/cc @mit-mit @pq @devoncarew @Hixie for discussion

@mit-mit mit-mit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just nits

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: consider removing the period in the url to avoid copy/paste issues

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: "practices"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if we're landing before this gets fixed, let's put the TODO (and maybe the commented-out code?) somewhere where it won't get stuck in people's analysis options for years.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I will fix this before submitting it. The Fix has already landed in the Dart SDK and engine, just waiting for a roll into the framework.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these changes are fantastic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"automatically upgrade" maybe?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

practices

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't this redundant with the analysis options? i'm not sure i understand how they relate. if we really need both we should definitely explain the difference in these files.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reworded the paragraph above. This line just makes the set of recommended lints available. The import in the analysis_options.yaml then activates that set.

@goderbauer goderbauer changed the title Integrate package:lints into templates Integrate package:flutter_lints into templates May 5, 2021
@goderbauer
goderbauer marked this pull request as ready for review May 6, 2021 00:09

@pq pq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this conflict with the private return types lint? Or is that not in the recommended set

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's not in the recommended set.

@jonahwilliams jonahwilliams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@goderbauer

Copy link
Copy Markdown
Member Author

Thank you!

Submission is now blocked on the tree becoming green and dart-lang/sdk#58383 rolling into the framework.

@devoncarew

Copy link
Copy Markdown
Contributor

Thank you!

Submission is now blocked on the tree becoming green and dart-lang/sdk#58383 rolling into the framework.

I believe the fix for this landed in dart-lang/sdk (dart-lang/sdk@f193637) ~8 days ago, so should likely already be available in flutter/flutter.

@goderbauer

Copy link
Copy Markdown
Member Author

I believe the fix for this landed in dart-lang/sdk (dart-lang/sdk@f193637) ~8 days ago, so should likely already be available in flutter/flutter.

While the fix has rolled into the engine, it's not available in flutter/flutter yet due to an unfortunate combination of engine rollbacks and tree closures. I believe the next engine roll into the framework will contain the fix, though, once the tree is open again.

My newly added tests is actually currently failing because the fix is not rolled in yet: https://github.com/flutter/flutter/pull/81417/checks?check_run_id=2520340935

@dnfield

dnfield commented May 10, 2021

Copy link
Copy Markdown
Contributor

This broke skp_generator tests.

@goderbauer

Copy link
Copy Markdown
Member Author

This broke skp_generator tests.

Could parts of that test run presubmit (e.g. at least analyzing the code) to avoid this in the future?

@Hixie

Hixie commented May 11, 2021

Copy link
Copy Markdown
Contributor

skp_generator should already be running presubmit

@Hixie

Hixie commented May 11, 2021

Copy link
Copy Markdown
Contributor

I don't see it there though, weird.

@Hixie

Hixie commented May 11, 2021

Copy link
Copy Markdown
Contributor

It was added in #81096

@Hixie

Hixie commented May 11, 2021

Copy link
Copy Markdown
Contributor

Fix in #82239

expect(exec.exitCode, 0);
expect(exec.exitCode, isNot(0));
String lineParser(String line) {
print('#$line#');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

was this a temporary debugging line that leaked in?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, yeah. Will send PR to remove.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

8 participants