-
Notifications
You must be signed in to change notification settings - Fork 267
Conversation
Codecov Report
@@ Coverage Diff @@
## master #463 +/- ##
=======================================
Coverage 83.35% 83.35%
=======================================
Files 188 188
Lines 3821 3821
=======================================
Hits 3185 3185
Misses 636 636 Continue to review full report at Codecov.
|
As I understand, the idea here is to introduce rule presets as The first (and most important) question for me is: do you know, is it allowed to have multiple files included into I tried using multiple There is a public JSON schema for I think users should be able to use dart code metrics presets together with any other rule preset package ( |
@roman-petrov good point, didn't think about that. Unfortunately, the docs say Because YAML doesn’t allow duplicate keys, you can include at most one file. which means that we should rather include lints package presets into our presets or discuss with the Dart team ability to list multiple urls under |
Personally, I am not sure if bundling I think it would be great to have the ability to include multiple files into
So finally, I think that an almost "ideal" solution would be if we had plugin support in dart linter, multiple include support in analysis options, implement dart code metrics linter rules via dart linter plugin API and run dart code metrics via Just having the ability to include multiple files into analysis options (for example, allowing a list of files to be passed into |
Actually, I have another option in mind: we can use some "virtual" configuration settings. For example, we can provide our own "extends" section in dart code metrics configuration in dart_code_metrics:
extends:
- dart-recommended
- flutter-all
rules:
no-magic-numers: false # if user likes to disable a rule from preset |
Yeah, totally agree on that.
Agreed. I think I'll ask Dart SDK team first and then we can decide, what to do next.
I think that could be our fallback solution, but the main drawback here is about implementing merging strategy again. And since we support merging from include, we also need to be able to merge a config from 3 different places. |
I've posted an issue, let's see, how it goes dart-lang/sdk#47256 |
Sure, let's follow this issue for now and see if we get some progress in a reasonable amount of time. |
@roman-petrov looks like we should not expect the API change from the analyzer team and implement our own extend logic. |
@roman-petrov could you take a look at initial questions and share your thoughts? |
@incendial, I will try to ask these questions below but definitely my answers are subject to further discussion...
I agree that's quite hard to make a default configuration suit everybody. But I still think that it is good to create a default config even with rules having complex configurations. When I create a new project I like to get out-of-the-box configuration without having to define/duplicate configuration in each project. For existing projects, of course, users should be able to easily override default configuration rule settings. Ideally, to create good default configurations, we should collect metrics from our users to find the most commonly used rule settings. Analytics is quite a big feature, so maybe we can try to find other ways to build default configurations. For example, we can analyze Flutter framework code, some Telegram votings, etc. Also we can start with "minimum" default presets and add new rules into default presets incrementally. For example, for complex rules like
This is quite an interesting question. IMHO, we should not include metrics into presets for now. Or we can just create separate "rule" and "metrics" presets. I still have not integrated metrics into my project and I am quite interested in completely separating rule/metrics workflow. Maybe I will create an issue with details/proposal someday.
I think we should isolate dart code metrics rule presets and not include/depend on anything external like Flutter presets. IMHO analyzer rules configuration and dart code metrics configuration should be completely separated and independent. Sorry for a such long post, I understand that it contains too few concrete ideas, only my thoughts :) And my original idea is the same as I posted above, adding the dart_code_metrics:
extends:
- dart-recommended
- flutter-all
rules:
no-magic-numers: false # if user likes to disable a rule from preset
member-ordering-extended: # if user likes to override default configuration |
I think we won't be able to introduce any kind of analytics (which I'm pretty sad with), so our only way will be to work directly with the community.
Good point, I see it the same way.
We discussed it some time ago with @dkrutskikh and I think that it's a possible way of the project development.
Sorry, the question was about ours config - should we include dart_recommended into flutter_recommended, or the users will need to do it in theirs projects manually? |
And thank you for sharing your thought, btw. It means so much! |
I also started thinking on this several months ago and have some ideas, in short:
This is not a proposal, just ideas about workflow & architecture. We can discuss this in separate issue if you think that this fits into dart code metrics roadmap.
I think I finally got you. In my opinion, having two separate independent configurations will give better flexibility. However, if we use our "extends" implementation users will have to extend two configurations to have all recommended rules enabled. But I think it's ok: two configuration lines instead of one line is not a serious drawback, flexibility is more important. So, finally, I think that it would be better to not include |
Closing this, will add the implementation separately |
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix
[ ] New rule
[ ] Changes an existing rule
[ ] Add autofixing to a rule
[ ] Add a CLI option
[X] Add something to the core
[ ] Other, please explain:
Let's continue the discussion about presets here with the code example.
I see several problems right now:
member-ordering-extended
) and I'm pretty concerned about the user seeing 2000 issues just because of the inappropriate order.@roman-petrov @dkrutskikh please share your thoughts and them we should probably bring this discussion to the community too.