Skip to content
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

Create tool which compares rulesets of different analysis_options.yaml #102

Open
shilangyu opened this issue May 16, 2023 · 4 comments
Open

Comments

@shilangyu
Copy link
Contributor

shilangyu commented May 16, 2023

Idea: I'd like to have an easy way to diff the rules enabled by flutter_lints and by leancode_lint.

Originally posted by @bartekpacia in #101 (review)

@shilangyu shilangyu self-assigned this May 16, 2023
@bartekpacia
Copy link
Contributor

bartekpacia commented May 16, 2023

Sounds like a fun task for somebody with some free time :)

I'll write my idea for it:

This tool would accept a lints yaml file, e.g. the one from flutter_lints and print all the rules it contains. If the lints yaml file includes other lints yaml files, rules from them must be recursively added to the result.

So in flutter_lints case:

flutter.yaml -> https://github.com/flutter/packages/blob/main/packages/flutter_lints/lib/flutter.yaml
└── recommended.yaml -> https://github.com/dart-lang/lints/blob/main/lib/recommended.yaml
    └── core.yaml -> https://github.com/dart-lang/lints/blob/main/lib/core.yaml

Maybe there's some existing package that already does this?

I also think it must for sure already exist somewhere in the analyzer internals.

@shilangyu
Copy link
Contributor Author

I already started researching this yesterday. Here is the place that implements this logic: https://github.com/dart-lang/sdk/blob/84f528d26dae3c75cad7c850321cbf1a15f96361/pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart#L63

Requires extra research how to actually use this outside of analyzer

@bartekpacia
Copy link
Contributor

bartekpacia commented May 16, 2023

Can a package depend on analyzer just like on any other package?

Depending on stuff from packages's src is bad but there's probably no other option in this case.

@shilangyu
Copy link
Contributor Author

shilangyu commented May 16, 2023

Can a package depend on analyzer just like on any other package?

Yes

Depending on stuff from packages's src is bad but there's probably no other option in this case.

Not sure why it isnt re-exported from lib. It seems the dart compiler packages import from src/ all the time for some reason. Looks like even outside packages import src/, like build_runner: https://github.com/dart-lang/build/blob/96e0ba6044a0620b31d99468e19b063367f7f410/build_resolvers/lib/src/resolver.dart#L16

@shilangyu shilangyu removed their assignment May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants