-
Notifications
You must be signed in to change notification settings - Fork 170
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
Minimal Config for Testing #41
Comments
Here's a strawman, using YAML since we're already parsing it elsewhere and it should be familiar.
The above includes/excludes propose gitignore-style expressions. Nothing set in stone of course. Comments very welcome. |
Can this already be tested or is this just a propisal? |
Just a rough idea as of yet. That said, if it looks reasonable, I'll go for it. |
Yeah, looks fine. |
Looks like a great start! I think the file set configuration is less urgent, since a package generally tries to adhere to a certain style throughout all its dart files, so the rule configuration gets you most of the way there. Having said that, I like I think snake_case rule identifiers may be more readable, since the rules may be phrase-like, e.g. If the rules are namespaced to a group, then the individual rules don't need to include the group name, so This would be e.g. a # File set description: lists of patterns to include/exclude
files:
include: **/src
exclude: test/data/**
# Rule sets; ignore for now rule set inheritance and externally contributed rules
# Basic format:
# [group]:
# [name]:
# ... config
rules:
style_guide:
unnecessary_getters: false
pub:
package_names:
enabled: false # longer form of package_names: false |
Thanks for the comments @seaneagan. A few follow-ups.
Agreed! I started implementing this over lunch and that's what I chose too.
👍
How about we support both? That is:
and, in case they want to specify more than one:
Incidentally, we'll need to quote the globs since
Neutral here. For some reason I was leaning towards
Agreed! |
I 'm currently working on a project where I use a lot of code generation. I might want to use different sets of rules for the generated files. |
@zoechi Agreed, one does care less about style in generated than hand-written code. It should be pretty easy to implement anyways considering the |
@pq Yep, supporting glob and list-of-glob would be ideal. I assumed having the rules ids matching the dart class names was a motiviation, but for me that's actually a negative since it feels like the impl leaking into the user interface. I looked at the JS linters:
They all agree on starting with a lower case letter. I actually think eslint's |
About code gen (it's a trending topic :)) with So it would be great to have a global exclusion for classes implementing something or annotated with something. |
@14n: thanks for chiming in! Can you add a link to the generator you're using? I'd be interested in taking a look. (EDIT: re-reading, I gather you mean source_gen.) @seaneagan : great points. Thanks for the links to prior art. I don't see any strong reason not to go with underscores. Thanks again for all the back and forth. Keep it coming! :) |
As far as annotations in source, I'm guessing we won't use metadata proper but will use some kind of comment convention. Open to ideas though. |
@pq yes I use source_gen to try to improve js-interop ( /cc @kevmoo ). I'm still looking for the good/best pattern to used and for now I use private classes as templates. For instance see the unused private class template used to generate the real public class. With the last version of the editor I get an hint:
I'd really like to have a way to disable this hint on every classes annotated with |
Ah, thanks for the clarification @a14n. Put that way, the issue really transcends the linter and is really about configuring the analyzer (cc @bwilkerson) since it's the source of the suspect hint. That said, we want to solve it consistently for lints and hints (and possibly warnings too) and I'm keen to push on that. I suspect there may well soon enough be lints you'll want to similarly disable in the context of |
Support for the provisional format is landed. Sample here. For now, configs are specified on the command line using the |
Works fine so far 👍 |
Bumping this old conversation as I'm doing a bit of a revisit on the way to tightening the integration with the analyzer. One thing I think I'd like to change for sure is the need to specify a group. IOW (assuming no name collisions), the following would be equivalent:
Sound reasonable? @zoechi : any more feedback? |
Verbosity doesn't bother me much, I just want to be able to express my requirements. Others often have a contrary opinion so they might love it :) I'd love to have more checks ;-) A check for imports from transitive dependencies #29 would have saved me quite some time today (caused weird crashes dart-lang/pub#1114). |
Closing for staleness. |
Separate from the larger question of configurability in general (#7), we need a minimal config format for testing purposes. Whatever it ends up being, it should be labeled as provisional and consider it entirely subject to review and change.
Minimally, I'd like to see ways to:
The text was updated successfully, but these errors were encountered: