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
CLI/.sqlfluff
enhancement: Rule globs
#1972
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1972 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 148 148
Lines 10311 10319 +8
=========================================
+ Hits 10311 10319 +8
Continue to review full report at Codecov.
|
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.
I've a few questions:
- Does this allow
exclude_rules = L001, L05*
and if so should we add a test? - Should we update our documentation for this?
- Should we take this as an opportunity to move to the more inclusive "allowlist/denylist" syntax? At least for the code touched here?
An additional question I'm wondering myself is if this glob stuff also applies to inline comments. I think it does but let's resolve #1985 first and then I'll investigate 👍 |
Looks like a dbt test failed in one of the builds? |
@barrywhart it didn't fail, the GHA runner lost internet connection so the install download failed. Should work fine once re-run 👍 |
@tunetheweb Follow up on your questions
LGTM 🚀 |
Brief summary of the change made
Fixes #1445. This PR provides the mechanism for rules to be included/excluded by globs in either the config files or via the CLI.
As well as resolving the linked issue, the big benefit of this will be to allow users to more easily bulk disable groups of rules
via the rule prefix, as I discussed in #1812. This is essentially what is happening in the #1445 as well just for plugins. Personally think this is a very elegant solution. Also this use case is what motivates the use of globs rather than regex as the expected use is simply
--rules "Core_*"
or--exclude-rules "Some_Plugin_*"
(or whatever prefixes we decide on), so keeps things nice and simple.Are there any other side effects of this change that we should be aware of?
No
Pull Request checklist
Please confirm you have completed any of the necessary steps below.
Included test cases to demonstrate any code changes, which may be one or more of the following:
.yml
rule test cases intest/fixtures/rules/std_rule_cases
..sql
/.yml
parser test cases intest/fixtures/dialects
(note YML files can be auto generated withpython test/generate_parse_fixture_yml.py
or by runningtox
locally).test/fixtures/linter/autofix
.Added appropriate documentation for the change.
Created GitHub issues for any relevant followup/future enhancements if appropriate.