-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
fix(configuration): enabled rules calculation #2072
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
A-CLI
Area: CLI
A-Project
Area: project
A-Tooling
Area: internal tools
labels
Mar 13, 2024
✅ Deploy Preview for biomejs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Conaclos
reviewed
Mar 13, 2024
Conaclos
approved these changes
Mar 13, 2024
LGTM. It could be great to add a changelog entry. |
Sec-ant
force-pushed
the
fix-rule-calculation
branch
from
March 13, 2024 11:59
da33bf6
to
3581368
Compare
1 task
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Changelog
Area: changelog
A-CLI
Area: CLI
A-Project
Area: project
A-Tooling
Area: internal tools
A-Website
Area: website
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
It turns out the existing function
as_enabled_rules
was calculating the enabled rules in a wrong way. The function is generated by codegen, so I fixed the logic inxtask/codegen/src/generate_configuration.rs
and regenerated that file. I summarize the correct logic as follows:For non-nursery groups
all
and group-levelrecommend
should take precedence over their top-level alternatives.all
or group-levelrecommend
is not present, it should fallback to check top-levelall
or top-levelrecommend
.all
or top-levelrecommend
.For nursery group
all
and group-levelrecommend
should take precedence over top-level alternatives. (same as non-nursery groups)all
or group-levelrecommend
is not present, it should fallback to check top-levelall
or top-levelrecommend
only in unstable releases.all
or top-levelrecommend
only in unstable releases.Fixes #2028.
Test Plan
Since the nursery group is unstable because the rules in it may be promoted in later releases, I didn't add test cases for the nursery group. But I tested it locally and it works as expected.
I added a test case called
top_level_all_down_level_empty
. It's to check whether the non-recommended rules belonging to a group will be enabled if we have a top-levelall
astrue
and an empty config of that group. The expected result is they should be kept enabled. In current release (v1.6.1
) they are wrongly disabled. I guess the reason why this issue isn't discovered earlier is because most rules under a group are recommended rules.