From 49c5e715f9c85aa8d0412b2ec9b1dd6f7ae24c5c Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Thu, 8 Feb 2024 22:06:51 +0100 Subject: [PATCH] Filter out test rules in `RuleSelector` JSON schema (#9901) --- .github/workflows/ci.yaml | 5 +---- crates/ruff_linter/src/rule_selector.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4ca1614154..1c8b6e5752 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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: diff --git a/crates/ruff_linter/src/rule_selector.rs b/crates/ruff_linter/src/rule_selector.rs index 001b6a5f22..8c1b113385 100644 --- a/crates/ruff_linter/src/rule_selector.rs +++ b/crates/ruff_linter/src/rule_selector.rs @@ -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(),