From 788643f718d954c8883a798d22ed1027557872bf Mon Sep 17 00:00:00 2001 From: Victor Hugo Gomes Date: Wed, 26 Jul 2023 19:48:53 -0300 Subject: [PATCH] Add "--select E402" to example snippet in `CONTRIBUTING.md` (#6108) ## Summary In Ruff only a subset of rules are enabled by default. This change change aims to clarify that when adding a new rule, you must explicitly use the `--select name_of_rule` command to ensure the rule gets executed. This was talked about on Discord a while back. ## Test Plan Checked docs via mkdocs --- CONTRIBUTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 246cd263b2..18d6fdb400 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -224,9 +224,12 @@ Once you've completed the code for the rule itself, you can define tests with th For example, if you're adding a new rule named `E402`, you would run: ```shell - cargo run -p ruff_cli -- check crates/ruff/resources/test/fixtures/pycodestyle/E402.py --no-cache + cargo run -p ruff_cli -- check crates/ruff/resources/test/fixtures/pycodestyle/E402.py --no-cache --select E402 ``` + **Note:** Only a subset of rules are enabled by default. When testing a new rule, ensure that + you activate it by adding `--select ${rule_code}` to the command. + 1. Add the test to the relevant `crates/ruff/src/rules/[linter]/mod.rs` file. If you're contributing a rule to a pre-existing set, you should be able to find a similar example to pattern-match against. If you're adding a new linter, you'll need to create a new `mod.rs` file (see,