-
-
Notifications
You must be signed in to change notification settings - Fork 508
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
feat(cli): add --only
and --skip
options
#2947
Conversation
49770f2
to
ad1ba1a
Compare
--only
and --skip
--only
and --skip
options
CodSpeed Performance ReportMerging #2947 will not alter performanceComparing Summary
|
c4a40f8
to
fb2a514
Compare
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
046715a
to
0c1eddf
Compare
I gave my explanation on Discord, I will copy it too here:
|
ed03882
to
34c9a13
Compare
crates/biome_analyze/src/lib.rs
Outdated
..AnalysisFilter::default() | ||
} | ||
pub fn match_rule<R: Rule>(&self) -> bool { | ||
self.enabled_rules.map_or(true, |enabled_rules| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to call match_group
because this check is already handled in filter.match_rule
. Thus, I removed this useless check.
crates/biome_analyze/src/lib.rs
Outdated
.iter() | ||
.any(|filter| filter.match_group::<G>()) | ||
!disabled_rules.iter().any(|filter| { | ||
matches!(filter, RuleFilter::Group(_)) && filter.match_group::<G>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation of match_group
was bogus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @Conaclos! This is going to be a great feature 🔥
d79109b
to
0221b06
Compare
Summary
This PR renames
--rule
into--only
and adds a new option--skip
.These two options can be repeated and used together.
When used together,
--skip
takes precedence over--only
(like--ignore
takes precedence overinclude
).For example, the following command executes only the
suspicious/noDebugger
rule and all the rules of thestyle
group, but skips thestyle/useNamingConvention
rule.Using
skip
on a group, skip all rules in the group.Conversely, using
--only
on a group, enable all rules of the group - even the ones explicitly disabled in the configuration.Limitations
Using
--only
disables the diagnostics about unused suppression comments.Ideally, we should also filter these diagnostics according to the enabled rules.
However, I don't know how to filter them based on that criteria.
Test Plan
I added tests and updated previous tests.