Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

migrate template defaults to use package:pedantic for lints #594

Merged
merged 8 commits into from
Jan 22, 2019

Conversation

pq
Copy link
Contributor

@pq pq commented Jan 16, 2019

Migrates templates to use the package:pedantic lint rule set.

I started with just one options file to keep word-smithing / bike-shedding in one place. When we're happy with it, I'll update the others before proposing to land.

Ready for review.

Additional context: https://github.com/dart-lang/linter/issues/1365.

Fixes #593.

/cc @kwalrath @kevmoo @chalin

Copy link
Contributor

@kwalrath kwalrath left a comment

Choose a reason for hiding this comment

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

lgtm, so far

@kwalrath kwalrath requested review from kevmoo and chalin January 16, 2019 20:21
@kevmoo
Copy link
Contributor

kevmoo commented Jan 17, 2019

I'm on the fence about using the actual pedantic import, etc. I think it's a bit too much magic for brand new packages.

I'd rather we copy-paste the lints in the file w/ a link to the pedantic repo.

@pq
Copy link
Contributor Author

pq commented Jan 17, 2019

I hear you. On the other hand:

  1. maybe it's good to nudge folks to use includes (because, you know, reuse, hygiene, yada, yada)
  2. if pana uses the latest pedantic lints to score packages (and I think it should), there will be skew and package scores could dip without the possible early warning
  3. I'm hoping we can update the Flutter templates to use includes so this will be more consistent w/ them
  4. an include makes it easier to eyeball if a package is "pedantic"

@pq
Copy link
Contributor Author

pq commented Jan 18, 2019

@kevmoo, @kwalrath: I took a stab at inlining the rules with some explanation. Needless to say it could use word-smithing but I wonder how the approach sits with you.

@kevmoo
Copy link
Contributor

kevmoo commented Jan 18, 2019

Thanks. There is an upside to depending on pkg:pedantic, but then we have the discussion about "do we pin the version or set a range". If we pin it, then we have to explain why we pin it. If we set a range, then 'pub upgrade' may add new lint warnings, which is weird. I think leaving it to the user to add the dependency is goodness

@pq
Copy link
Contributor Author

pq commented Jan 18, 2019

@kevmoo: that's my thinking too. I totally punted on pinning and that's probably OK. Should we at least include the pedantic version we're deriving from in the comment? Maybe something like:

# Google-default lint rules as defined in package:pedantic (v1.4.0).
# See: https://github.com/dart-lang/pedantic for details and the latest
# ruleset.

Back to pinning, maybe we could add a breadcrumb in the pubspec:

dev_dependencies:
#   include the latest pedantic rules 
#   pedantic: ^1.0.0
#   alternatively, pin to a specific version, if you want to ensure that newly added rules can't break us
#   pedantic: 1.4.0

/fyi @davidmorgan.

@kevmoo
Copy link
Contributor

kevmoo commented Jan 18, 2019 via email

@pq
Copy link
Contributor Author

pq commented Jan 18, 2019

@chalin
Copy link
Contributor

chalin commented Jan 18, 2019

My vote would be for @pq's original proposal: just import pedantic.

In this way newbies get the default set of lints out-of-the-box; a list that is continually updated and curated by expert Dart users (mainly based, I assume on internal projects). Power users will know how to twiddle things :) to their liking, including if/when to pin a package to a version or not.

I don't like the non-DRY suggestion of having a comment like "Google-default lint rules as defined in package:pedantic (v1.4.0)" and then duplicating the pedantic list (from one specific point in time). That is just more maintenance for us down the line.

My 2 cents :)

@devoncarew
Copy link
Contributor

My vote would be for @pq's original proposal: just import pedantic.

Yeah, this does keep things nice and simple.

@kevmoo
Copy link
Contributor

kevmoo commented Jan 18, 2019 via email

@pq
Copy link
Contributor Author

pq commented Jan 18, 2019

OK! Updated to the first proposal and maybe ready to go?

PTAL. Word-smithing welcome.

@pq pq requested a review from devoncarew January 18, 2019 23:35
Copy link
Contributor

@kevmoo kevmoo left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@chalin chalin left a comment

Choose a reason for hiding this comment

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

Overall LGTM. I'll let @kwalrath have the final word w.r.t. word-smithing :)

@davidmorgan
Copy link

Looks good, thanks!

@pq
Copy link
Contributor Author

pq commented Jan 22, 2019

@kwalrath : any thoughts on wording (or otherwise)?

@kwalrath
Copy link
Contributor

Looking now...

Copy link
Contributor

@kwalrath kwalrath left a comment

Choose a reason for hiding this comment

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

Once you remove the unneeded semicolon before the URL (in all pubspec copies), LGTM.

@@ -1,14 +1,14 @@
# Defines a default set of lint rules enforced for
# projects at Google. For details and rationale,
# see: https://github.com/dart-lang/pedantic#enabled-lints.
Copy link
Contributor

Choose a reason for hiding this comment

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

see: -> see

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

consider updating template to use package:pedantic lints
6 participants