-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[various] Enable warnings as errors, and all warnings, for Android lint #3648
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
[various] Enable warnings as errors, and all warnings, for Android lint #3648
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Open question for the review: are there any warnings we should add to the ignore list as part of this? We can decide incrementally later, but if there's anything we want to do in every package (like we've done with things like I checked the baseline files to see what errors are in them and how often, and got:
Any thoughts on the common ones in particular?
|
Overriding changelog and version since my understanding is that |
test-exempt: is testing |
In case anyone else is curious about the per-plugin breakdown:
(It looks like about a third of the webview issues are Pigeon-generated, so we'll need a few Pigeon generation fixes [Edit to add: I just landed a Pigeon change that should make it lint-clean for Java, so as we update Pigeon in packages we'll fix a bunch of issues.]) |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
That seems like the better option; having it flag any new APIs we create seems worthwhile. |
I'll update this PR tomorrow to change the repo tooling to check that these two flags are set for all packages so we don't accidentally forget in the future (e.g., when adding a new Android plugin or implementation). |
I'm going to land this without waiting for the iOS flaky hang to resolve, since this PR can't affect iOS, and it's very prone to bitrot. |
.platformDirectory(FlutterPlatform.android) | ||
.childFile('build.gradle') | ||
.readAsLinesSync(); | ||
return gradleBuildContents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider writing this match to ignore lines that are commented out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make that change if you want; there are potential downsides though. The current approach is to enforce that we haven't just forgotten to set this up when adding a new package. Allowing commenting it out allows for someone to explicitly say "I know that this is supposed to be set up, but I'm turning it off for now for a specific reason". I actually did exactly that with the javac
part of this file previously, where for packages that weren't ready yet I added the line it was looking for commented out, with a TODO referencing an issue.
That may not be a useful thing to support for this though, where we can use the baseline file as an escape hatch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to support disabling a check that makes sense. I guess I think of commented out lines passing a check that is expected as a foot gun. I would expect something like # ignore checkAllWarnings
to be how it was disabled.
I don't think it is important enough to go back and rework unless you happen to be working on the code already.
…nt (flutter#3648) For all Android plugins: - Enable all warnings for `lint` - Treat all warnings as errors for `lint` This significantly increases the scope of issues that we'll catch in CI. To allow enabling this without having to make tons of fixes first, so that we get the incremental benefit immediately, this adds new baselines for all plugins. We can incrementally clean those baselines up over time. (In practice we haven't prioritized that, but it would be good to start paying down that technical debt incrementally at some point.) See flutter/flutter#88011
For all Android plugins:
lint
lint
This significantly increases the scope of issues that we'll catch in CI. To allow enabling this without having to make tons of fixes first, so that we get the incremental benefit immediately, this adds new baselines for all plugins. We can incrementally clean those baselines up over time. (In practice we haven't prioritized that, but it would be good to start paying down that technical debt incrementally at some point.)
See flutter/flutter#88011
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).