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

Conversation

@zanderso
Copy link
Member

@zanderso zanderso commented Jun 12, 2021

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

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

@gaaclarke gaaclarke left a comment

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.

_lintAction ??= await _getLintAction();


Future<LintAction> _getLintAction() async {
Copy link
Member

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

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

@zanderso zanderso force-pushed the move-linter branch 2 times, most recently from 796511b to 68712d3 Compare June 22, 2021 23:32
Copy link
Member

@gaaclarke gaaclarke left a comment

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:master Jun 23, 2021
moffatman pushed a commit to moffatman/engine that referenced this pull request Aug 5, 2021
naudzghebre pushed a commit to naudzghebre/engine that referenced this pull request Sep 2, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants