Skip to content

Commit

Permalink
Filter out test rules in RuleSelector JSON schema (#9901)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Feb 8, 2024
1 parent fe7d965 commit 49c5e71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ jobs:
tool: cargo-insta
- uses: Swatinem/rust-cache@v2
- name: "Run tests"
run: cargo insta test --all --exclude ruff_dev --all-features --unreferenced reject
- name: "Run dev tests"
# e.g. generating the schema — these should not run with all features enabled
run: cargo insta test -p ruff_dev --unreferenced reject
run: cargo insta test --all --all-features --unreferenced reject
# Check for broken links in the documentation.
- run: cargo doc --all --no-deps
env:
Expand Down
9 changes: 9 additions & 0 deletions crates/ruff_linter/src/rule_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ mod schema {
true
}
})
.filter(|rule| {
// Filter out all test-only rules
#[cfg(feature = "test-rules")]
if rule.starts_with("RUF9") {
return false;
}

true
})
.sorted()
.map(Value::String)
.collect(),
Expand Down

0 comments on commit 49c5e71

Please sign in to comment.