Skip to content

Conversation

@goderbauer
Copy link
Member

@goderbauer goderbauer commented Apr 28, 2021

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
Member Author

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

Copy link
Member

@mit-mit mit-mit left a comment

Choose a reason for hiding this comment

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

Just nits

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
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
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
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
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
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
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
Contributor

Choose a reason for hiding this comment

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

practices

Copy link
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
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
Copy link
Contributor

@pq pq left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
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
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.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@goderbauer
Copy link
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
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
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
Copy link
Contributor

dnfield commented May 10, 2021

This broke skp_generator tests.

@goderbauer
Copy link
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
Copy link
Contributor

Hixie commented May 11, 2021

skp_generator should already be running presubmit

@Hixie
Copy link
Contributor

Hixie commented May 11, 2021

I don't see it there though, weird.

@Hixie
Copy link
Contributor

Hixie commented May 11, 2021

It was added in #81096

@Hixie
Copy link
Contributor

Hixie commented May 11, 2021

Fix in #82239

expect(exec.exitCode, 0);
expect(exec.exitCode, isNot(0));
String lineParser(String line) {
print('#$line#');
Copy link
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
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
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