Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Make ci/lint.dart more idiomatic and move to tools/clang_tidy - #26722

Merged
fluttergithubbot merged 1 commit into
flutter-team-archive:masterfrom
zanderso:move-linter
Jun 23, 2021
Merged

fluttergithubbot merged 1 commit into
flutter-team-archive:masterfrom
zanderso:move-linter

Conversation

@zanderso

@zanderso zanderso commented Jun 12, 2021 •

Copy link
Copy Markdown
Contributor

This PR reorganizes ci/lint.dart into a more typical Dart program/library, and adds some tests.

@zanderso zanderso added the Work in progress (WIP) Not ready (yet) for review! label Jun 12, 2021
@flutter-dashboard

Copy link
Copy Markdown

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.

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.

@google-cla google-cla Bot added the cla: yes label Jun 12, 2021
@zanderso zanderso mentioned this pull request Jun 12, 2021
@zanderso zanderso changed the title Make ci/lint.dart more idiomatic and move to tools/engine_linter Make ci/lint.dart more idiomatic and move to tools/clang_tidy Jun 21, 2021
@zanderso
zanderso force-pushed the move-linter branch 4 times, most recently from ee4053c to 250ce13 Compare June 22, 2021 22:19
@zanderso zanderso removed the Work in progress (WIP) Not ready (yet) for review! label Jun 22, 2021
@zanderso
zanderso requested review from dnfield and gaaclarke June 22, 2021 22:25

@gaaclarke gaaclarke 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.

Nice, just a basket of nits. Big picture, looking good.

Comment thread tools/clang_tidy/README.md Outdated
Comment thread tools/clang_tidy/lib/clang_tidy.dart Outdated
Comment thread tools/clang_tidy/lib/clang_tidy.dart Outdated
Comment thread tools/clang_tidy/lib/clang_tidy.dart Outdated
Comment thread tools/clang_tidy/lib/clang_tidy.dart
Comment thread tools/clang_tidy/lib/clang_tidy.dart
Comment thread tools/clang_tidy/lib/src/command.dart Outdated
_lintAction ??= await _getLintAction();


Future<LintAction> _getLintAction() async {

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: this is a good candidate for a pure function that could be made visible for testing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll give this some thought. Available options for testing the functionality are abstracting the input file stream, providing a fake file system implementation, or writing to the /tmp file system, none of which are very attractive.

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.

<light hearted rant follows, feel free to ignore it since it isn't a huge deal>

I'm not suggesting writing tests per say, just suggesting that factoring out pure functions (ignoring the filesystem) makes them more testable and by extension more maintainable since they are able to be executed in isolation and the contract of input versus output is more clear than a method (who can touch any instance variable, thus having less encapsulation).

This one was so close to being a static function I thought I'd mention it in my Quixotic quest to make our codebase more Functional.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's a good cause. I shuffled things around a bit. I was gloomy at first since I didn't want to abstract out the file system, but I found a way around it.

Comment thread tools/clang_tidy/lib/src/git_repo.dart
@zanderso
zanderso force-pushed the move-linter branch 2 times, most recently from 796511b to 68712d3 Compare June 22, 2021 23:32

@gaaclarke gaaclarke 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

@zanderso zanderso added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jun 23, 2021
@fluttergithubbot
fluttergithubbot merged commit 12c25d0 into flutter-team-archive:master Jun 23, 2021
@zanderso
zanderso deleted the move-linter branch May 2, 2022 03:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Development

Successfully merging this pull request may close these issues.

3 participants