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
[flutter_tools] Separate style and data from AnalysisError #60591
[flutter_tools] Separate style and data from AnalysisError #60591
Conversation
Extract error data structure and wrap it with command line styles according to the platform, terminal, fileSystem.
This pull request was opened against a branch other than master. Since Flutter pull requests should not normally be opened against branches other than master, I have changed the base to master. If this was intended, you may modify the base back to dev. See the Release Process for information about how other branches get updated. Reviewers: Use caution before merging pull requests to branches other than master, unless this is an intentional hotfix/cherrypick. |
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. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
1 similar comment
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. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
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.
It would be nice to add some unit test coverage to WrittenError. The existing tests are mostly integration and don't really cover the small cases like JSON serialization well.
Thank you williams for reviewing, all fixed. |
packages/flutter_tools/test/commands.shard/hermetic/analyze_test.dart
Outdated
Show resolved
Hide resolved
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
Except for the small change in the test
@IncludeCmath this will land automatically once the build is green, all good to go here 👍 |
Google testing is pending @jonahwilliams |
Extract error data structure and wrap it with command line styles according to the platform, terminal, fileSystem.
Description
#49589 commit reduce context usage in analyze command and tests, and also introduce new variables(platform, terminal, fileSystem).These new variables affect output styles in different environments.
I suggest to extract error information data structure from the
AnalysisError
class. So we can useWrittenError
for plain text content. And wrapWrittenError
withAnalysisError
.Related Issues
Replace this paragraph with a list of issues related to this PR from our issue database. Indicate, which of these issues are resolved or fixed by this PR. There should be at least one issue listed here.
Tests
I added the following tests:
Reuse
flutter analyze
command test case.Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.