mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-27 02:16:32 +00:00
Improvement documentation around ignore-names globbing (#7674)
## Summary Improves the documentation on the setting itself, along with that on the relevant rules. Closes https://github.com/astral-sh/ruff/issues/7660.
This commit is contained in:
parent
0a8cad2550
commit
15f3d8c8e0
6 changed files with 40 additions and 7 deletions
|
|
@ -22,6 +22,11 @@ use crate::checkers::ast::Checker;
|
|||
/// > append a single trailing underscore rather than use an abbreviation or spelling corruption.
|
||||
/// > Thus `class_` is better than `clss`. (Perhaps better is to avoid such clashes by using a synonym.)
|
||||
///
|
||||
/// Names can be excluded from this rule using the [`pep8-naming.ignore-names`]
|
||||
/// or [`pep8-naming.extend-ignore-names`] configuration options. For example,
|
||||
/// to allow the use of `klass` as the first argument to class methods, set
|
||||
/// the [`pep8-naming.extend-ignore-names`] option to `["klass"]`.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
/// class Example:
|
||||
|
|
@ -42,6 +47,7 @@ use crate::checkers::ast::Checker;
|
|||
/// - `pep8-naming.classmethod-decorators`
|
||||
/// - `pep8-naming.staticmethod-decorators`
|
||||
/// - `pep8-naming.ignore-names`
|
||||
/// - `pep8-naming.extend-ignore-names`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-method-arguments
|
||||
#[violation]
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ use crate::checkers::ast::Checker;
|
|||
/// > append a single trailing underscore rather than use an abbreviation or spelling corruption.
|
||||
/// > Thus `class_` is better than `clss`. (Perhaps better is to avoid such clashes by using a synonym.)
|
||||
///
|
||||
/// Names can be excluded from this rule using the [`pep8-naming.ignore-names`]
|
||||
/// or [`pep8-naming.extend-ignore-names`] configuration options. For example,
|
||||
/// to allow the use of `this` as the first argument to instance methods, set
|
||||
/// the [`pep8-naming.extend-ignore-names`] option to `["this"]`.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
/// class Example:
|
||||
|
|
@ -40,6 +45,7 @@ use crate::checkers::ast::Checker;
|
|||
/// - `pep8-naming.classmethod-decorators`
|
||||
/// - `pep8-naming.staticmethod-decorators`
|
||||
/// - `pep8-naming.ignore-names`
|
||||
/// - `pep8-naming.extend-ignore-names`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-method-arguments
|
||||
#[violation]
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ use crate::settings::types::IdentifierPattern;
|
|||
/// > improve readability. mixedCase is allowed only in contexts where that’s already the
|
||||
/// > prevailing style (e.g. threading.py), to retain backwards compatibility.
|
||||
///
|
||||
/// Names can be excluded from this rule using the [`pep8-naming.ignore-names`]
|
||||
/// or [`pep8-naming.extend-ignore-names`] configuration options. For example,
|
||||
/// to ignore all functions starting with `test_` from this rule, set the
|
||||
/// [`pep8-naming.extend-ignore-names`] option to `["test_*"]`.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
/// def myFunction():
|
||||
|
|
@ -34,6 +39,7 @@ use crate::settings::types::IdentifierPattern;
|
|||
///
|
||||
/// ## Options
|
||||
/// - `pep8-naming.ignore-names`
|
||||
/// - `pep8-naming.extend-ignore-names`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-variable-names
|
||||
#[violation]
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ use crate::rules::pep8_naming::helpers;
|
|||
///
|
||||
/// ## Options
|
||||
/// - `pep8-naming.ignore-names`
|
||||
/// - `pep8-naming.extend-ignore-names`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#function-and-variable-names
|
||||
#[violation]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue