From 640972f773f4b21fa858e4eab266cb7b2c7c2d30 Mon Sep 17 00:00:00 2001 From: Simon Brugman Date: Mon, 13 Feb 2023 17:43:50 +0100 Subject: [PATCH] docs: add `ignore_names` option --- .../rules/invalid_first_argument_name_for_class_method.rs | 1 + .../rules/invalid_first_argument_name_for_method.rs | 4 +++- .../ruff/src/rules/pep8_naming/rules/invalid_function_name.rs | 4 ++++ .../pep8_naming/rules/non_lowercase_variable_in_function.rs | 4 ++++ docs/rules/invalid-argument-name.md | 2 +- docs/rules/invalid-first-argument-name-for-class-method.md | 1 + docs/rules/invalid-first-argument-name-for-method.md | 4 +++- docs/rules/invalid-function-name.md | 4 ++++ docs/rules/non-lowercase-variable-in-function.md | 4 ++++ 9 files changed, 25 insertions(+), 3 deletions(-) diff --git a/crates/ruff/src/rules/pep8_naming/rules/invalid_first_argument_name_for_class_method.rs b/crates/ruff/src/rules/pep8_naming/rules/invalid_first_argument_name_for_class_method.rs index 397369bc61ccf5..a2bd76afd6edea 100644 --- a/crates/ruff/src/rules/pep8_naming/rules/invalid_first_argument_name_for_class_method.rs +++ b/crates/ruff/src/rules/pep8_naming/rules/invalid_first_argument_name_for_class_method.rs @@ -26,6 +26,7 @@ define_violation!( /// /// * `pep8-naming.classmethod-decorators` /// * `pep8-naming.staticmethod-decorators` + /// * `pep8-naming.ignore_names` /// /// ## Example /// diff --git a/crates/ruff/src/rules/pep8_naming/rules/invalid_first_argument_name_for_method.rs b/crates/ruff/src/rules/pep8_naming/rules/invalid_first_argument_name_for_method.rs index 6555a4273ba838..a0bff16f432db0 100644 --- a/crates/ruff/src/rules/pep8_naming/rules/invalid_first_argument_name_for_method.rs +++ b/crates/ruff/src/rules/pep8_naming/rules/invalid_first_argument_name_for_method.rs @@ -14,7 +14,8 @@ define_violation!( /// /// ## Why is this bad? /// - /// Using `self` as first argument for instance methods is recommended by [PEP8](https://peps.python.org/pep-0008/#function-and-method-arguments): + /// Using `self` as first argument for instance methods is recommended by + /// [PEP8](https://peps.python.org/pep-0008/#function-and-method-arguments): /// /// > Always use self for the first argument to instance methods. /// > @@ -26,6 +27,7 @@ define_violation!( /// /// * `pep8-naming.classmethod-decorators` /// * `pep8-naming.staticmethod-decorators` + /// * `pep8-naming.ignore_names` /// /// ## Example /// diff --git a/crates/ruff/src/rules/pep8_naming/rules/invalid_function_name.rs b/crates/ruff/src/rules/pep8_naming/rules/invalid_function_name.rs index 8bf5970568289b..321701d0b5d32f 100644 --- a/crates/ruff/src/rules/pep8_naming/rules/invalid_function_name.rs +++ b/crates/ruff/src/rules/pep8_naming/rules/invalid_function_name.rs @@ -20,6 +20,10 @@ define_violation!( /// > improve readability. mixedCase is allowed only in contexts where that’s already the /// > prevailing style (e.g. threading.py), to retain backwards compatibility. /// + /// ## Options + /// + /// * `pep8-naming.ignore_names` + /// /// ## Example /// /// ```python diff --git a/crates/ruff/src/rules/pep8_naming/rules/non_lowercase_variable_in_function.rs b/crates/ruff/src/rules/pep8_naming/rules/non_lowercase_variable_in_function.rs index d02c459af001b2..80032ccbca4c8c 100644 --- a/crates/ruff/src/rules/pep8_naming/rules/non_lowercase_variable_in_function.rs +++ b/crates/ruff/src/rules/pep8_naming/rules/non_lowercase_variable_in_function.rs @@ -22,6 +22,10 @@ define_violation!( /// > is allowed only in contexts where that's already the prevailing style (e.g. threading.py), /// to retain backwards compatibility. /// + /// ## Options + /// + /// * `pep8-naming.ignore_names` + /// /// ## Example /// /// ```python diff --git a/docs/rules/invalid-argument-name.md b/docs/rules/invalid-argument-name.md index 1736ecd23f1afa..5a7b47e266b16b 100644 --- a/docs/rules/invalid-argument-name.md +++ b/docs/rules/invalid-argument-name.md @@ -35,4 +35,4 @@ class MyClass: ## References -* [PEP8](https://peps.python.org/pep-0008/) \ No newline at end of file +* [PEP8](https://peps.python.org/pep-0008/) diff --git a/docs/rules/invalid-first-argument-name-for-class-method.md b/docs/rules/invalid-first-argument-name-for-class-method.md index 5cb1f361c47a96..ccb72952d7be52 100644 --- a/docs/rules/invalid-first-argument-name-for-class-method.md +++ b/docs/rules/invalid-first-argument-name-for-class-method.md @@ -20,6 +20,7 @@ Using `cls` as first argument for class methods is recommended by [PEP8](https:/ * `pep8-naming.classmethod-decorators` * `pep8-naming.staticmethod-decorators` +* `pep8-naming.ignore_names` ## Example diff --git a/docs/rules/invalid-first-argument-name-for-method.md b/docs/rules/invalid-first-argument-name-for-method.md index c06b510933edc1..019cc44d61c74c 100644 --- a/docs/rules/invalid-first-argument-name-for-method.md +++ b/docs/rules/invalid-first-argument-name-for-method.md @@ -8,7 +8,8 @@ Checks for instance methods to have `self` as first argument. ## Why is this bad? -Using `self` as first argument for instance methods is recommended by [PEP8](https://peps.python.org/pep-0008/#function-and-method-arguments): +Using `self` as first argument for instance methods is recommended by +[PEP8](https://peps.python.org/pep-0008/#function-and-method-arguments): > Always use self for the first argument to instance methods. > @@ -20,6 +21,7 @@ Using `self` as first argument for instance methods is recommended by [PEP8](htt * `pep8-naming.classmethod-decorators` * `pep8-naming.staticmethod-decorators` +* `pep8-naming.ignore_names` ## Example diff --git a/docs/rules/invalid-function-name.md b/docs/rules/invalid-function-name.md index b12b1a3f8aa08e..88f7522582ba24 100644 --- a/docs/rules/invalid-function-name.md +++ b/docs/rules/invalid-function-name.md @@ -15,6 +15,10 @@ Function names should be lowercase, with words separated by underscores, is reco > improve readability. mixedCase is allowed only in contexts where that’s already the > prevailing style (e.g. threading.py), to retain backwards compatibility. +## Options + +* `pep8-naming.ignore_names` + ## Example ```python diff --git a/docs/rules/non-lowercase-variable-in-function.md b/docs/rules/non-lowercase-variable-in-function.md index ecb47b26472c28..bfaa866bdd4eb8 100644 --- a/docs/rules/non-lowercase-variable-in-function.md +++ b/docs/rules/non-lowercase-variable-in-function.md @@ -16,6 +16,10 @@ Variable names in functions should be lowercase as recommended by > is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility. +## Options + +* `pep8-naming.ignore_names` + ## Example ```python