mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:24 +00:00
Docs: tweak rules documentation (#14180)
Co-authored-by: Micha Reiser <micha@reiser.io> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
272d24bf3e
commit
d1ef418bb0
56 changed files with 164 additions and 98 deletions
|
@ -469,7 +469,7 @@ impl Violation for MissingReturnTypeClassMethod {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 484](https://www.python.org/dev/peps/pep-0484/#the-any-type)
|
/// - [Typing spec: `Any`](https://typing.readthedocs.io/en/latest/spec/special-types.html#any)
|
||||||
/// - [Python documentation: `typing.Any`](https://docs.python.org/3/library/typing.html#typing.Any)
|
/// - [Python documentation: `typing.Any`](https://docs.python.org/3/library/typing.html#typing.Any)
|
||||||
/// - [Mypy documentation: The Any type](https://mypy.readthedocs.io/en/stable/kinds_of_types.html#the-any-type)
|
/// - [Mypy documentation: The Any type](https://mypy.readthedocs.io/en/stable/kinds_of_types.html#the-any-type)
|
||||||
#[violation]
|
#[violation]
|
||||||
|
|
|
@ -10,16 +10,21 @@ use crate::checkers::ast::Checker;
|
||||||
use crate::registry::AsRule;
|
use crate::registry::AsRule;
|
||||||
|
|
||||||
/// ## What it does
|
/// ## What it does
|
||||||
/// Checks for imports of the`telnetlib` module.
|
/// Checks for imports of the `telnetlib` module.
|
||||||
///
|
///
|
||||||
/// ## Why is this bad?
|
/// ## Why is this bad?
|
||||||
/// Telnet is considered insecure. Instead, use SSH or another encrypted
|
/// Telnet is considered insecure. It is deprecated since version 3.11, and
|
||||||
|
/// was removed in version 3.13. Instead, use SSH or another encrypted
|
||||||
/// protocol.
|
/// protocol.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
/// import telnetlib
|
/// import telnetlib
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## References
|
||||||
|
/// - [Python documentation: `telnetlib` - Telnet client](https://docs.python.org/3.12/library/telnetlib.html#module-telnetlib)
|
||||||
|
/// - [PEP 594: `telnetlib`](https://peps.python.org/pep-0594/#telnetlib)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct SuspiciousTelnetlibImport;
|
pub struct SuspiciousTelnetlibImport;
|
||||||
|
|
||||||
|
@ -41,6 +46,9 @@ impl Violation for SuspiciousTelnetlibImport {
|
||||||
/// ```python
|
/// ```python
|
||||||
/// import ftplib
|
/// import ftplib
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## References
|
||||||
|
/// - [Python documentation: `ftplib` - FTP protocol client](https://docs.python.org/3/library/ftplib.html)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct SuspiciousFtplibImport;
|
pub struct SuspiciousFtplibImport;
|
||||||
|
|
||||||
|
@ -63,8 +71,9 @@ impl Violation for SuspiciousFtplibImport {
|
||||||
/// ```python
|
/// ```python
|
||||||
/// import pickle
|
/// import pickle
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python Docs](https://docs.python.org/3/library/pickle.html)
|
/// - [Python documentation: `pickle` — Python object serialization](https://docs.python.org/3/library/pickle.html)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct SuspiciousPickleImport;
|
pub struct SuspiciousPickleImport;
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ use ruff_text_size::Ranged;
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Common Weakness Enumeration: CWE-22](https://cwe.mitre.org/data/definitions/22.html)
|
/// - [Common Weakness Enumeration: CWE-22](https://cwe.mitre.org/data/definitions/22.html)
|
||||||
/// - [Python Documentation: `TarFile.extractall`](https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall)
|
/// - [Python documentation: `TarFile.extractall`](https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall)
|
||||||
/// - [Python Documentation: Extraction filters](https://docs.python.org/3/library/tarfile.html#tarfile-extraction-filter)
|
/// - [Python documentation: Extraction filters](https://docs.python.org/3/library/tarfile.html#tarfile-extraction-filter)
|
||||||
///
|
///
|
||||||
/// [PEP 706]: https://peps.python.org/pep-0706/#backporting-forward-compatibility
|
/// [PEP 706]: https://peps.python.org/pep-0706/#backporting-forward-compatibility
|
||||||
#[violation]
|
#[violation]
|
||||||
|
|
|
@ -60,7 +60,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: The `try` statement](https://docs.python.org/3/reference/compound_stmts.html#the-try-statement)
|
/// - [Python documentation: The `try` statement](https://docs.python.org/3/reference/compound_stmts.html#the-try-statement)
|
||||||
/// - [Python documentation: Exception hierarchy](https://docs.python.org/3/library/exceptions.html#exception-hierarchy)
|
/// - [Python documentation: Exception hierarchy](https://docs.python.org/3/library/exceptions.html#exception-hierarchy)
|
||||||
/// - [PEP8 Programming Recommendations on bare `except`](https://peps.python.org/pep-0008/#programming-recommendations)
|
/// - [PEP 8: Programming Recommendations on bare `except`](https://peps.python.org/pep-0008/#programming-recommendations)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct BlindExcept {
|
pub struct BlindExcept {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -88,7 +88,7 @@ impl Violation for AbstractBaseClassWithoutAbstractMethod {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: abc](https://docs.python.org/3/library/abc.html)
|
/// - [Python documentation: `abc`](https://docs.python.org/3/library/abc.html)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct EmptyMethodWithoutAbstractDecorator {
|
pub struct EmptyMethodWithoutAbstractDecorator {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -28,7 +28,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 257](https://peps.python.org/pep-0257/)
|
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||||
/// - [Python documentation: Formatted string literals](https://docs.python.org/3/reference/lexical_analysis.html#f-strings)
|
/// - [Python documentation: Formatted string literals](https://docs.python.org/3/reference/lexical_analysis.html#f-strings)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct FStringDocstring;
|
pub struct FStringDocstring;
|
||||||
|
|
|
@ -40,7 +40,7 @@ use crate::checkers::ast::Checker;
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [The Hitchhiker's Guide to Python: Late Binding Closures](https://docs.python-guide.org/writing/gotchas/#late-binding-closures)
|
/// - [The Hitchhiker's Guide to Python: Late Binding Closures](https://docs.python-guide.org/writing/gotchas/#late-binding-closures)
|
||||||
/// - [Python documentation: functools.partial](https://docs.python.org/3/library/functools.html#functools.partial)
|
/// - [Python documentation: `functools.partial`](https://docs.python.org/3/library/functools.html#functools.partial)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct FunctionUsesLoopVariable {
|
pub struct FunctionUsesLoopVariable {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -26,6 +26,9 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```python
|
/// ```python
|
||||||
/// warnings.warn("This is a warning", stacklevel=2)
|
/// warnings.warn("This is a warning", stacklevel=2)
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## References
|
||||||
|
/// - [Python documentation: `warnings.warn`](https://docs.python.org/3/library/warnings.html#warnings.warn)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct NoExplicitStacklevel;
|
pub struct NoExplicitStacklevel;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: contextlib.suppress](https://docs.python.org/3/library/contextlib.html#contextlib.suppress)
|
/// - [Python documentation: `contextlib.suppress`](https://docs.python.org/3/library/contextlib.html#contextlib.suppress)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UselessContextlibSuppress;
|
pub struct UselessContextlibSuppress;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,9 @@ use crate::checkers::ast::Checker;
|
||||||
/// dict.fromkeys(iterable)
|
/// dict.fromkeys(iterable)
|
||||||
/// dict.fromkeys(iterable, 1)
|
/// dict.fromkeys(iterable, 1)
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## References
|
||||||
|
/// - [Python documentation: `dict.fromkeys`](https://docs.python.org/3/library/stdtypes.html#dict.fromkeys)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnnecessaryDictComprehensionForIterable {
|
pub struct UnnecessaryDictComprehensionForIterable {
|
||||||
is_value_none_literal: bool,
|
is_value_none_literal: bool,
|
||||||
|
@ -53,7 +56,7 @@ impl Violation for UnnecessaryDictComprehensionForIterable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RUF025
|
/// C420
|
||||||
pub(crate) fn unnecessary_dict_comprehension_for_iterable(
|
pub(crate) fn unnecessary_dict_comprehension_for_iterable(
|
||||||
checker: &mut Checker,
|
checker: &mut Checker,
|
||||||
dict_comp: &ast::ExprDictComp,
|
dict_comp: &ast::ExprDictComp,
|
||||||
|
|
|
@ -39,7 +39,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: gettext](https://docs.python.org/3/library/gettext.html)
|
/// - [Python documentation: `gettext` — Multilingual internationalization services](https://docs.python.org/3/library/gettext.html)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct FStringInGetTextFuncCall;
|
pub struct FStringInGetTextFuncCall;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: gettext](https://docs.python.org/3/library/gettext.html)
|
/// - [Python documentation: `gettext` — Multilingual internationalization services](https://docs.python.org/3/library/gettext.html)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct FormatInGetTextFuncCall;
|
pub struct FormatInGetTextFuncCall;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ use ruff_text_size::Ranged;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: gettext](https://docs.python.org/3/library/gettext.html)
|
/// - [Python documentation: `gettext` — Multilingual internationalization services](https://docs.python.org/3/library/gettext.html)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct PrintfInGetTextFuncCall;
|
pub struct PrintfInGetTextFuncCall;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ use crate::Locator;
|
||||||
///
|
///
|
||||||
/// Directories that lack an `__init__.py` file can still be imported, but
|
/// Directories that lack an `__init__.py` file can still be imported, but
|
||||||
/// they're indicative of a special kind of package, known as a "namespace
|
/// they're indicative of a special kind of package, known as a "namespace
|
||||||
/// package" (see: [PEP 420](https://www.python.org/dev/peps/pep-0420/)).
|
/// package" (see: [PEP 420](https://peps.python.org/pep-0420/)).
|
||||||
/// Namespace packages are less widely used, so a package that lacks an
|
/// Namespace packages are less widely used, so a package that lacks an
|
||||||
/// `__init__.py` file is typically meant to be a regular package, and
|
/// `__init__.py` file is typically meant to be a regular package, and
|
||||||
/// the absence of the `__init__.py` file is probably an oversight.
|
/// the absence of the `__init__.py` file is probably an oversight.
|
||||||
|
|
|
@ -30,7 +30,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// The [typing documentation on stub files](https://typing.readthedocs.io/en/latest/source/stubs.html#version-and-platform-checks)
|
/// - [Typing documentation: Version and platform checking](https://typing.readthedocs.io/en/latest/spec/directives.html#version-and-platform-checks)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct ComplexIfStatementInStub;
|
pub struct ComplexIfStatementInStub;
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [The recommended style for stub functions and methods](https://typing.readthedocs.io/en/latest/source/stubs.html#id6)
|
/// - [Typing documentation - Writing and Maintaining Stub Files](https://typing.readthedocs.io/en/latest/guides/writing_stubs.html)
|
||||||
/// in the typing docs.
|
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct NonEmptyStubBody;
|
pub struct NonEmptyStubBody;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// def __iadd__(self, other: Foo) -> Self: ...
|
/// def __iadd__(self, other: Foo) -> Self: ...
|
||||||
/// ```
|
/// ```
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [`typing.Self` documentation](https://docs.python.org/3/library/typing.html#typing.Self)
|
/// - [Python documentation: `typing.Self`](https://docs.python.org/3/library/typing.html#typing.Self)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct NonSelfReturnType {
|
pub struct NonSelfReturnType {
|
||||||
class_name: String,
|
class_name: String,
|
||||||
|
|
|
@ -23,8 +23,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// The [recommended style for functions and methods](https://typing.readthedocs.io/en/latest/source/stubs.html#functions-and-methods)
|
/// - [Typing documentation - Writing and Maintaining Stub Files](https://typing.readthedocs.io/en/latest/guides/writing_stubs.html)
|
||||||
/// in the typing docs.
|
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct PassStatementStubBody;
|
pub struct PassStatementStubBody;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Static Typing with Python: Type Stubs](https://typing.readthedocs.io/en/latest/source/stubs.html)
|
/// - [Typing documentation - Writing and Maintaining Stub Files](https://typing.readthedocs.io/en/latest/guides/writing_stubs.html)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct QuotedAnnotationInStub;
|
pub struct QuotedAnnotationInStub;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [The typing specification](https://docs.python.org/3/library/numbers.html#the-numeric-tower)
|
/// - [Python documentation: The numeric tower](https://docs.python.org/3/library/numbers.html#the-numeric-tower)
|
||||||
/// - [PEP 484: The numeric tower](https://peps.python.org/pep-0484/#the-numeric-tower)
|
/// - [PEP 484: The numeric tower](https://peps.python.org/pep-0484/#the-numeric-tower)
|
||||||
///
|
///
|
||||||
/// [typing specification]: https://typing.readthedocs.io/en/latest/spec/special-types.html#special-cases-for-float-and-complex
|
/// [typing specification]: https://typing.readthedocs.io/en/latest/spec/special-types.html#special-cases-for-float-and-complex
|
||||||
|
|
|
@ -40,7 +40,7 @@ use crate::registry::Rule;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Typing stubs documentation: Version and Platform Checks](https://typing.readthedocs.io/en/latest/source/stubs.html#version-and-platform-checks)
|
/// - [Typing documentation: Version and Platform checking](https://typing.readthedocs.io/en/latest/spec/directives.html#version-and-platform-checks)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnrecognizedPlatformCheck;
|
pub struct UnrecognizedPlatformCheck;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ impl Violation for UnrecognizedPlatformCheck {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Typing stubs documentation: Version and Platform Checks](https://typing.readthedocs.io/en/latest/source/stubs.html#version-and-platform-checks)
|
/// - [Typing documentation: Version and Platform checking](https://typing.readthedocs.io/en/latest/spec/directives.html#version-and-platform-checks)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnrecognizedPlatformName {
|
pub struct UnrecognizedPlatformName {
|
||||||
platform: String,
|
platform: String,
|
||||||
|
|
|
@ -31,7 +31,7 @@ use crate::registry::Rule;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Typing stubs documentation: Version and Platform Checks](https://typing.readthedocs.io/en/latest/source/stubs.html#version-and-platform-checks)
|
/// - [Typing documentation: Version and Platform checking](https://typing.readthedocs.io/en/latest/spec/directives.html#version-and-platform-checks)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnrecognizedVersionInfoCheck;
|
pub struct UnrecognizedVersionInfoCheck;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ impl Violation for UnrecognizedVersionInfoCheck {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Typing stubs documentation: Version and Platform Checks](https://typing.readthedocs.io/en/latest/source/stubs.html#version-and-platform-checks)
|
/// - [Typing documentation: Version and Platform checking](https://typing.readthedocs.io/en/latest/spec/directives.html#version-and-platform-checks)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct PatchVersionComparison;
|
pub struct PatchVersionComparison;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ impl Violation for PatchVersionComparison {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Typing stubs documentation: Version and Platform Checks](https://typing.readthedocs.io/en/latest/source/stubs.html#version-and-platform-checks)
|
/// - [Typing documentation: Version and Platform checking](https://typing.readthedocs.io/en/latest/spec/directives.html#version-and-platform-checks)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct WrongTupleLengthVersionComparison {
|
pub struct WrongTupleLengthVersionComparison {
|
||||||
expected_length: usize,
|
expected_length: usize,
|
||||||
|
|
|
@ -590,7 +590,7 @@ impl AlwaysFixableViolation for PytestErroneousUseFixturesOnFixture {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [`pytest-asyncio`](https://pypi.org/project/pytest-asyncio/)
|
/// - [PyPI: `pytest-asyncio`](https://pypi.org/project/pytest-asyncio/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct PytestUnnecessaryAsyncioMarkOnFixture;
|
pub struct PytestUnnecessaryAsyncioMarkOnFixture;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ use ruff_text_size::Ranged;
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `unittest.mock.patch`](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch)
|
/// - [Python documentation: `unittest.mock.patch`](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch)
|
||||||
/// - [`pytest-mock`](https://pypi.org/project/pytest-mock/)
|
/// - [PyPI: `pytest-mock`](https://pypi.org/project/pytest-mock/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct PytestPatchWithLambda;
|
pub struct PytestPatchWithLambda;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ use crate::fix;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 535](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
/// - [PEP 563: Runtime annotation resolution and `TYPE_CHECKING`](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct EmptyTypeCheckingBlock;
|
pub struct EmptyTypeCheckingBlock;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ use crate::rules::flake8_type_checking::imports::ImportBinding;
|
||||||
/// - `lint.flake8-type-checking.quote-annotations`
|
/// - `lint.flake8-type-checking.quote-annotations`
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 535](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
/// - [PEP 563: Runtime annotation resolution and `TYPE_CHECKING`](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct RuntimeImportInTypeCheckingBlock {
|
pub struct RuntimeImportInTypeCheckingBlock {
|
||||||
qualified_name: String,
|
qualified_name: String,
|
||||||
|
|
|
@ -37,8 +37,8 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 535](https://peps.python.org/pep-0563/)
|
/// - [PEP 563 - Postponed Evaluation of Annotations](https://peps.python.org/pep-0563/)
|
||||||
/// - [PEP 604](https://peps.python.org/pep-0604/)
|
/// - [PEP 604 – Allow writing union types as `X | Y`](https://peps.python.org/pep-0604/)
|
||||||
///
|
///
|
||||||
/// [PEP 604]: https://peps.python.org/pep-0604/
|
/// [PEP 604]: https://peps.python.org/pep-0604/
|
||||||
#[violation]
|
#[violation]
|
||||||
|
|
|
@ -71,7 +71,7 @@ use crate::rules::isort::{categorize, ImportSection, ImportType};
|
||||||
/// - `lint.typing-modules`
|
/// - `lint.typing-modules`
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
/// - [PEP 563: Runtime annotation resolution and `TYPE_CHECKING`](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct TypingOnlyFirstPartyImport {
|
pub struct TypingOnlyFirstPartyImport {
|
||||||
qualified_name: String,
|
qualified_name: String,
|
||||||
|
@ -146,7 +146,7 @@ impl Violation for TypingOnlyFirstPartyImport {
|
||||||
/// - `lint.typing-modules`
|
/// - `lint.typing-modules`
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
/// - [PEP 563: Runtime annotation resolution and `TYPE_CHECKING`](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct TypingOnlyThirdPartyImport {
|
pub struct TypingOnlyThirdPartyImport {
|
||||||
qualified_name: String,
|
qualified_name: String,
|
||||||
|
@ -221,7 +221,7 @@ impl Violation for TypingOnlyThirdPartyImport {
|
||||||
/// - `lint.typing-modules`
|
/// - `lint.typing-modules`
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 536](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
/// - [PEP 563: Runtime annotation resolution and `TYPE_CHECKING`](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct TypingOnlyStandardLibraryImport {
|
pub struct TypingOnlyStandardLibraryImport {
|
||||||
qualified_name: String,
|
qualified_name: String,
|
||||||
|
|
|
@ -19,6 +19,10 @@ use crate::registry::Rule;
|
||||||
/// An argument that is defined but not used is likely a mistake, and should
|
/// An argument that is defined but not used is likely a mistake, and should
|
||||||
/// be removed to avoid confusion.
|
/// be removed to avoid confusion.
|
||||||
///
|
///
|
||||||
|
/// If a variable is intentionally defined-but-not-used, it should be
|
||||||
|
/// prefixed with an underscore, or some other value that adheres to the
|
||||||
|
/// [`lint.dummy-variable-rgx`] pattern.
|
||||||
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
/// def foo(bar, baz):
|
/// def foo(bar, baz):
|
||||||
|
@ -30,6 +34,9 @@ use crate::registry::Rule;
|
||||||
/// def foo(bar):
|
/// def foo(bar):
|
||||||
/// return bar * 2
|
/// return bar * 2
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## Options
|
||||||
|
/// - `lint.dummy-variable-rgx`
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnusedFunctionArgument {
|
pub struct UnusedFunctionArgument {
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -50,6 +57,10 @@ impl Violation for UnusedFunctionArgument {
|
||||||
/// An argument that is defined but not used is likely a mistake, and should
|
/// An argument that is defined but not used is likely a mistake, and should
|
||||||
/// be removed to avoid confusion.
|
/// be removed to avoid confusion.
|
||||||
///
|
///
|
||||||
|
/// If a variable is intentionally defined-but-not-used, it should be
|
||||||
|
/// prefixed with an underscore, or some other value that adheres to the
|
||||||
|
/// [`lint.dummy-variable-rgx`] pattern.
|
||||||
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
/// class Class:
|
/// class Class:
|
||||||
|
@ -63,6 +74,9 @@ impl Violation for UnusedFunctionArgument {
|
||||||
/// def foo(self, arg1):
|
/// def foo(self, arg1):
|
||||||
/// print(arg1)
|
/// print(arg1)
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## Options
|
||||||
|
/// - `lint.dummy-variable-rgx`
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnusedMethodArgument {
|
pub struct UnusedMethodArgument {
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -83,6 +97,10 @@ impl Violation for UnusedMethodArgument {
|
||||||
/// An argument that is defined but not used is likely a mistake, and should
|
/// An argument that is defined but not used is likely a mistake, and should
|
||||||
/// be removed to avoid confusion.
|
/// be removed to avoid confusion.
|
||||||
///
|
///
|
||||||
|
/// If a variable is intentionally defined-but-not-used, it should be
|
||||||
|
/// prefixed with an underscore, or some other value that adheres to the
|
||||||
|
/// [`lint.dummy-variable-rgx`] pattern.
|
||||||
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
/// class Class:
|
/// class Class:
|
||||||
|
@ -98,6 +116,9 @@ impl Violation for UnusedMethodArgument {
|
||||||
/// def foo(cls, arg1):
|
/// def foo(cls, arg1):
|
||||||
/// print(arg1)
|
/// print(arg1)
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## Options
|
||||||
|
/// - `lint.dummy-variable-rgx`
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnusedClassMethodArgument {
|
pub struct UnusedClassMethodArgument {
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -118,6 +139,10 @@ impl Violation for UnusedClassMethodArgument {
|
||||||
/// An argument that is defined but not used is likely a mistake, and should
|
/// An argument that is defined but not used is likely a mistake, and should
|
||||||
/// be removed to avoid confusion.
|
/// be removed to avoid confusion.
|
||||||
///
|
///
|
||||||
|
/// If a variable is intentionally defined-but-not-used, it should be
|
||||||
|
/// prefixed with an underscore, or some other value that adheres to the
|
||||||
|
/// [`lint.dummy-variable-rgx`] pattern.
|
||||||
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
/// class Class:
|
/// class Class:
|
||||||
|
@ -133,6 +158,9 @@ impl Violation for UnusedClassMethodArgument {
|
||||||
/// def foo(arg1):
|
/// def foo(arg1):
|
||||||
/// print(arg1)
|
/// print(arg1)
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## Options
|
||||||
|
/// - `lint.dummy-variable-rgx`
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnusedStaticMethodArgument {
|
pub struct UnusedStaticMethodArgument {
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -154,6 +182,10 @@ impl Violation for UnusedStaticMethodArgument {
|
||||||
/// An argument that is defined but not used is likely a mistake, and should
|
/// An argument that is defined but not used is likely a mistake, and should
|
||||||
/// be removed to avoid confusion.
|
/// be removed to avoid confusion.
|
||||||
///
|
///
|
||||||
|
/// If a variable is intentionally defined-but-not-used, it should be
|
||||||
|
/// prefixed with an underscore, or some other value that adheres to the
|
||||||
|
/// [`lint.dummy-variable-rgx`] pattern.
|
||||||
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
/// my_list = [1, 2, 3, 4, 5]
|
/// my_list = [1, 2, 3, 4, 5]
|
||||||
|
@ -165,6 +197,9 @@ impl Violation for UnusedStaticMethodArgument {
|
||||||
/// my_list = [1, 2, 3, 4, 5]
|
/// my_list = [1, 2, 3, 4, 5]
|
||||||
/// squares = map(lambda x: x**2, my_list)
|
/// squares = map(lambda x: x**2, my_list)
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## Options
|
||||||
|
/// - `lint.dummy-variable-rgx`
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnusedLambdaArgument {
|
pub struct UnusedLambdaArgument {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -32,7 +32,7 @@ use ruff_macros::{derive_message_formats, violation};
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.stat`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.stat)
|
/// - [Python documentation: `Path.stat`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.stat)
|
||||||
/// - [Python documentation: `os.path.getatime`](https://docs.python.org/3/library/os.path.html#os.path.getatime)
|
/// - [Python documentation: `os.path.getatime`](https://docs.python.org/3/library/os.path.html#os.path.getatime)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
|
|
@ -32,7 +32,7 @@ use ruff_macros::{derive_message_formats, violation};
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.stat`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.stat)
|
/// - [Python documentation: `Path.stat`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.stat)
|
||||||
/// - [Python documentation: `os.path.getctime`](https://docs.python.org/3/library/os.path.html#os.path.getctime)
|
/// - [Python documentation: `os.path.getctime`](https://docs.python.org/3/library/os.path.html#os.path.getctime)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
|
|
@ -32,7 +32,7 @@ use ruff_macros::{derive_message_formats, violation};
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.stat`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.stat)
|
/// - [Python documentation: `Path.stat`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.stat)
|
||||||
/// - [Python documentation: `os.path.getmtime`](https://docs.python.org/3/library/os.path.html#os.path.getmtime)
|
/// - [Python documentation: `os.path.getmtime`](https://docs.python.org/3/library/os.path.html#os.path.getmtime)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
|
|
@ -32,7 +32,7 @@ use ruff_macros::{derive_message_formats, violation};
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.stat`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.stat)
|
/// - [Python documentation: `Path.stat`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.stat)
|
||||||
/// - [Python documentation: `os.path.getsize`](https://docs.python.org/3/library/os.path.html#os.path.getsize)
|
/// - [Python documentation: `os.path.getsize`](https://docs.python.org/3/library/os.path.html#os.path.getsize)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
|
|
@ -30,7 +30,7 @@ use ruff_macros::{derive_message_formats, violation};
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.resolve`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve)
|
/// - [Python documentation: `Path.resolve`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve)
|
||||||
/// - [Python documentation: `os.path.abspath`](https://docs.python.org/3/library/os.path.html#os.path.abspath)
|
/// - [Python documentation: `os.path.abspath`](https://docs.python.org/3/library/os.path.html#os.path.abspath)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -73,7 +73,7 @@ impl Violation for OsPathAbspath {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.chmod`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.chmod)
|
/// - [Python documentation: `Path.chmod`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.chmod)
|
||||||
/// - [Python documentation: `os.chmod`](https://docs.python.org/3/library/os.html#os.chmod)
|
/// - [Python documentation: `os.chmod`](https://docs.python.org/3/library/os.html#os.chmod)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -116,7 +116,7 @@ impl Violation for OsChmod {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.mkdir`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.mkdir)
|
/// - [Python documentation: `Path.mkdir`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.mkdir)
|
||||||
/// - [Python documentation: `os.makedirs`](https://docs.python.org/3/library/os.html#os.makedirs)
|
/// - [Python documentation: `os.makedirs`](https://docs.python.org/3/library/os.html#os.makedirs)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -159,7 +159,7 @@ impl Violation for OsMakedirs {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.mkdir`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.mkdir)
|
/// - [Python documentation: `Path.mkdir`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.mkdir)
|
||||||
/// - [Python documentation: `os.mkdir`](https://docs.python.org/3/library/os.html#os.mkdir)
|
/// - [Python documentation: `os.mkdir`](https://docs.python.org/3/library/os.html#os.mkdir)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -202,7 +202,7 @@ impl Violation for OsMkdir {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.rename`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.rename)
|
/// - [Python documentation: `Path.rename`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.rename)
|
||||||
/// - [Python documentation: `os.rename`](https://docs.python.org/3/library/os.html#os.rename)
|
/// - [Python documentation: `os.rename`](https://docs.python.org/3/library/os.html#os.rename)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -245,7 +245,7 @@ impl Violation for OsRename {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.replace`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.replace)
|
/// - [Python documentation: `Path.replace`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.replace)
|
||||||
/// - [Python documentation: `os.replace`](https://docs.python.org/3/library/os.html#os.replace)
|
/// - [Python documentation: `os.replace`](https://docs.python.org/3/library/os.html#os.replace)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -288,7 +288,7 @@ impl Violation for OsReplace {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.rmdir`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.rmdir)
|
/// - [Python documentation: `Path.rmdir`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.rmdir)
|
||||||
/// - [Python documentation: `os.rmdir`](https://docs.python.org/3/library/os.html#os.rmdir)
|
/// - [Python documentation: `os.rmdir`](https://docs.python.org/3/library/os.html#os.rmdir)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -331,7 +331,7 @@ impl Violation for OsRmdir {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.unlink`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.unlink)
|
/// - [Python documentation: `Path.unlink`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.unlink)
|
||||||
/// - [Python documentation: `os.remove`](https://docs.python.org/3/library/os.html#os.remove)
|
/// - [Python documentation: `os.remove`](https://docs.python.org/3/library/os.html#os.remove)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -374,7 +374,7 @@ impl Violation for OsRemove {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.unlink`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.unlink)
|
/// - [Python documentation: `Path.unlink`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.unlink)
|
||||||
/// - [Python documentation: `os.unlink`](https://docs.python.org/3/library/os.html#os.unlink)
|
/// - [Python documentation: `os.unlink`](https://docs.python.org/3/library/os.html#os.unlink)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -418,7 +418,7 @@ impl Violation for OsUnlink {
|
||||||
/// - [Python documentation: `Path.cwd`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.cwd)
|
/// - [Python documentation: `Path.cwd`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.cwd)
|
||||||
/// - [Python documentation: `os.getcwd`](https://docs.python.org/3/library/os.html#os.getcwd)
|
/// - [Python documentation: `os.getcwd`](https://docs.python.org/3/library/os.html#os.getcwd)
|
||||||
/// - [Python documentation: `os.getcwdb`](https://docs.python.org/3/library/os.html#os.getcwdb)
|
/// - [Python documentation: `os.getcwdb`](https://docs.python.org/3/library/os.html#os.getcwdb)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -461,7 +461,7 @@ impl Violation for OsGetcwd {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.exists`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.exists)
|
/// - [Python documentation: `Path.exists`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.exists)
|
||||||
/// - [Python documentation: `os.path.exists`](https://docs.python.org/3/library/os.path.html#os.path.exists)
|
/// - [Python documentation: `os.path.exists`](https://docs.python.org/3/library/os.path.html#os.path.exists)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -504,7 +504,7 @@ impl Violation for OsPathExists {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.expanduser`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.expanduser)
|
/// - [Python documentation: `Path.expanduser`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.expanduser)
|
||||||
/// - [Python documentation: `os.path.expanduser`](https://docs.python.org/3/library/os.path.html#os.path.expanduser)
|
/// - [Python documentation: `os.path.expanduser`](https://docs.python.org/3/library/os.path.html#os.path.expanduser)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -547,7 +547,7 @@ impl Violation for OsPathExpanduser {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.is_dir`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.is_dir)
|
/// - [Python documentation: `Path.is_dir`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.is_dir)
|
||||||
/// - [Python documentation: `os.path.isdir`](https://docs.python.org/3/library/os.path.html#os.path.isdir)
|
/// - [Python documentation: `os.path.isdir`](https://docs.python.org/3/library/os.path.html#os.path.isdir)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -590,7 +590,7 @@ impl Violation for OsPathIsdir {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.is_file`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.is_file)
|
/// - [Python documentation: `Path.is_file`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.is_file)
|
||||||
/// - [Python documentation: `os.path.isfile`](https://docs.python.org/3/library/os.path.html#os.path.isfile)
|
/// - [Python documentation: `os.path.isfile`](https://docs.python.org/3/library/os.path.html#os.path.isfile)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -633,7 +633,7 @@ impl Violation for OsPathIsfile {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.is_symlink`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.is_symlink)
|
/// - [Python documentation: `Path.is_symlink`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.is_symlink)
|
||||||
/// - [Python documentation: `os.path.islink`](https://docs.python.org/3/library/os.path.html#os.path.islink)
|
/// - [Python documentation: `os.path.islink`](https://docs.python.org/3/library/os.path.html#os.path.islink)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -676,7 +676,7 @@ impl Violation for OsPathIslink {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.readlink`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.readline)
|
/// - [Python documentation: `Path.readlink`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.readline)
|
||||||
/// - [Python documentation: `os.readlink`](https://docs.python.org/3/library/os.html#os.readlink)
|
/// - [Python documentation: `os.readlink`](https://docs.python.org/3/library/os.html#os.readlink)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -728,7 +728,7 @@ impl Violation for OsReadlink {
|
||||||
/// - [Python documentation: `Path.group`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.group)
|
/// - [Python documentation: `Path.group`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.group)
|
||||||
/// - [Python documentation: `Path.owner`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.owner)
|
/// - [Python documentation: `Path.owner`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.owner)
|
||||||
/// - [Python documentation: `os.stat`](https://docs.python.org/3/library/os.html#os.stat)
|
/// - [Python documentation: `os.stat`](https://docs.python.org/3/library/os.html#os.stat)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -774,7 +774,7 @@ impl Violation for OsStat {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `PurePath.is_absolute`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.is_absolute)
|
/// - [Python documentation: `PurePath.is_absolute`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.is_absolute)
|
||||||
/// - [Python documentation: `os.path.isabs`](https://docs.python.org/3/library/os.path.html#os.path.isabs)
|
/// - [Python documentation: `os.path.isabs`](https://docs.python.org/3/library/os.path.html#os.path.isabs)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -817,7 +817,7 @@ impl Violation for OsPathIsabs {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `PurePath.joinpath`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.joinpath)
|
/// - [Python documentation: `PurePath.joinpath`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.joinpath)
|
||||||
/// - [Python documentation: `os.path.join`](https://docs.python.org/3/library/os.path.html#os.path.join)
|
/// - [Python documentation: `os.path.join`](https://docs.python.org/3/library/os.path.html#os.path.join)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -877,7 +877,7 @@ pub(crate) enum Joiner {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `PurePath.name`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.name)
|
/// - [Python documentation: `PurePath.name`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.name)
|
||||||
/// - [Python documentation: `os.path.basename`](https://docs.python.org/3/library/os.path.html#os.path.basename)
|
/// - [Python documentation: `os.path.basename`](https://docs.python.org/3/library/os.path.html#os.path.basename)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -920,7 +920,7 @@ impl Violation for OsPathBasename {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `PurePath.parent`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.parent)
|
/// - [Python documentation: `PurePath.parent`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.parent)
|
||||||
/// - [Python documentation: `os.path.dirname`](https://docs.python.org/3/library/os.path.html#os.path.dirname)
|
/// - [Python documentation: `os.path.dirname`](https://docs.python.org/3/library/os.path.html#os.path.dirname)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -963,7 +963,7 @@ impl Violation for OsPathDirname {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.samefile`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.samefile)
|
/// - [Python documentation: `Path.samefile`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.samefile)
|
||||||
/// - [Python documentation: `os.path.samefile`](https://docs.python.org/3/library/os.path.html#os.path.samefile)
|
/// - [Python documentation: `os.path.samefile`](https://docs.python.org/3/library/os.path.html#os.path.samefile)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -1015,7 +1015,7 @@ impl Violation for OsPathSamefile {
|
||||||
/// - [Python documentation: `Path.suffix`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffix)
|
/// - [Python documentation: `Path.suffix`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffix)
|
||||||
/// - [Python documentation: `Path.suffixes`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffixes)
|
/// - [Python documentation: `Path.suffixes`](https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffixes)
|
||||||
/// - [Python documentation: `os.path.splitext`](https://docs.python.org/3/library/os.path.html#os.path.splitext)
|
/// - [Python documentation: `os.path.splitext`](https://docs.python.org/3/library/os.path.html#os.path.splitext)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
@ -1055,7 +1055,7 @@ impl Violation for OsPathSplitext {
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: `Path.open`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.open)
|
/// - [Python documentation: `Path.open`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.open)
|
||||||
/// - [Python documentation: `open`](https://docs.python.org/3/library/functions.html#open)
|
/// - [Python documentation: `open`](https://docs.python.org/3/library/functions.html#open)
|
||||||
/// - [PEP 428](https://peps.python.org/pep-0428/)
|
/// - [PEP 428 – The pathlib module – object-oriented filesystem paths](https://peps.python.org/pep-0428/)
|
||||||
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
/// - [Correspondence between `os` and `pathlib`](https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module)
|
||||||
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
/// - [Why you should be using pathlib](https://treyhunner.com/2018/12/why-you-should-be-using-pathlib/)
|
||||||
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
/// - [No really, pathlib is great](https://treyhunner.com/2019/01/no-really-pathlib-is-great/)
|
||||||
|
|
|
@ -33,7 +33,7 @@ use crate::Locator;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [_Why You Should Probably Never Use pandas inplace=True_](https://towardsdatascience.com/why-you-should-probably-never-use-pandas-inplace-true-9f9f211849e4)
|
/// - [_Why You Should Probably Never Use pandas `inplace=True`_](https://towardsdatascience.com/why-you-should-probably-never-use-pandas-inplace-true-9f9f211849e4)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct PandasUseOfInplaceArgument;
|
pub struct PandasUseOfInplaceArgument;
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,10 @@ use crate::rules::pep8_naming::helpers;
|
||||||
/// from example import MyClassName
|
/// from example import MyClassName
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [PEP 8]: https://peps.python.org/pep-0008/
|
|
||||||
///
|
|
||||||
/// ## Options
|
/// ## Options
|
||||||
/// - `lint.flake8-import-conventions.aliases`
|
/// - `lint.flake8-import-conventions.aliases`
|
||||||
|
///
|
||||||
|
/// [PEP 8]: https://peps.python.org/pep-0008/
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct CamelcaseImportedAsAcronym {
|
pub struct CamelcaseImportedAsAcronym {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -61,7 +61,7 @@ const BLANK_LINES_NESTED_LEVEL: u32 = 1;
|
||||||
/// them. That's why this rule is not enabled in typing stub files.
|
/// them. That's why this rule is not enabled in typing stub files.
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 8](https://peps.python.org/pep-0008/#blank-lines)
|
/// - [PEP 8: Blank Lines](https://peps.python.org/pep-0008/#blank-lines)
|
||||||
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E301.html)
|
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E301.html)
|
||||||
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
||||||
#[violation]
|
#[violation]
|
||||||
|
@ -114,7 +114,7 @@ impl AlwaysFixableViolation for BlankLineBetweenMethods {
|
||||||
/// - `lint.isort.lines-after-imports`
|
/// - `lint.isort.lines-after-imports`
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 8](https://peps.python.org/pep-0008/#blank-lines)
|
/// - [PEP 8: Blank Lines](https://peps.python.org/pep-0008/#blank-lines)
|
||||||
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E302.html)
|
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E302.html)
|
||||||
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
||||||
#[violation]
|
#[violation]
|
||||||
|
@ -181,7 +181,7 @@ impl AlwaysFixableViolation for BlankLinesTopLevel {
|
||||||
/// - `lint.isort.lines-between-types`
|
/// - `lint.isort.lines-between-types`
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 8](https://peps.python.org/pep-0008/#blank-lines)
|
/// - [PEP 8: Blank Lines](https://peps.python.org/pep-0008/#blank-lines)
|
||||||
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E303.html)
|
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E303.html)
|
||||||
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
||||||
#[violation]
|
#[violation]
|
||||||
|
@ -228,7 +228,7 @@ impl AlwaysFixableViolation for TooManyBlankLines {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 8](https://peps.python.org/pep-0008/#blank-lines)
|
/// - [PEP 8: Blank Lines](https://peps.python.org/pep-0008/#blank-lines)
|
||||||
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E304.html)
|
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E304.html)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct BlankLineAfterDecorator {
|
pub struct BlankLineAfterDecorator {
|
||||||
|
@ -278,7 +278,7 @@ impl AlwaysFixableViolation for BlankLineAfterDecorator {
|
||||||
/// them. That's why this rule is not enabled in typing stub files.
|
/// them. That's why this rule is not enabled in typing stub files.
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 8](https://peps.python.org/pep-0008/#blank-lines)
|
/// - [PEP 8: Blank Lines](https://peps.python.org/pep-0008/#blank-lines)
|
||||||
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E305.html)
|
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E305.html)
|
||||||
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
||||||
#[violation]
|
#[violation]
|
||||||
|
@ -332,7 +332,7 @@ impl AlwaysFixableViolation for BlankLinesAfterFunctionOrClass {
|
||||||
/// them. That's why this rule is not enabled in typing stub files.
|
/// them. That's why this rule is not enabled in typing stub files.
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 8](https://peps.python.org/pep-0008/#blank-lines)
|
/// - [PEP 8: Blank Lines](https://peps.python.org/pep-0008/#blank-lines)
|
||||||
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E306.html)
|
/// - [Flake 8 rule](https://www.flake8rules.com/rules/E306.html)
|
||||||
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
/// - [Typing Style Guide](https://typing.readthedocs.io/en/latest/source/stubs.html#blank-lines)
|
||||||
#[violation]
|
#[violation]
|
||||||
|
|
|
@ -52,7 +52,7 @@ use crate::Locator;
|
||||||
/// See [#10885](https://github.com/astral-sh/ruff/issues/10885) for more.
|
/// See [#10885](https://github.com/astral-sh/ruff/issues/10885) for more.
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 498](https://www.python.org/dev/peps/pep-0498/)
|
/// - [PEP 498 – Literal String Interpolation](https://peps.python.org/pep-0498/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct FStringMissingPlaceholders;
|
pub struct FStringMissingPlaceholders;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ use ruff_macros::{derive_message_formats, violation};
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 563](https://www.python.org/dev/peps/pep-0563/)
|
/// - [PEP 563 – Postponed Evaluation of Annotations](https://peps.python.org/pep-0563/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct ForwardAnnotationSyntaxError {
|
pub struct ForwardAnnotationSyntaxError {
|
||||||
pub body: String,
|
pub body: String,
|
||||||
|
|
|
@ -13,6 +13,9 @@ use ruff_macros::{derive_message_formats, violation};
|
||||||
/// In Python 3, no more than 1 << 8 assignments are allowed before a starred
|
/// In Python 3, no more than 1 << 8 assignments are allowed before a starred
|
||||||
/// expression, and no more than 1 << 24 expressions are allowed after a starred
|
/// expression, and no more than 1 << 24 expressions are allowed after a starred
|
||||||
/// expression.
|
/// expression.
|
||||||
|
///
|
||||||
|
/// ## References
|
||||||
|
/// - [PEP 3132 – Extended Iterable Unpacking](https://peps.python.org/pep-3132/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct ExpressionsInStarAssignment;
|
pub struct ExpressionsInStarAssignment;
|
||||||
|
|
||||||
|
@ -38,7 +41,7 @@ impl Violation for ExpressionsInStarAssignment {
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 3132](https://peps.python.org/pep-3132/)
|
/// - [PEP 3132 – Extended Iterable Unpacking](https://peps.python.org/pep-3132/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct MultipleStarredExpressions;
|
pub struct MultipleStarredExpressions;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 484](https://peps.python.org/pep-0484/)
|
/// - [PEP 484 – Type Hints](https://peps.python.org/pep-0484/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnusedAnnotation {
|
pub struct UnusedAnnotation {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -32,7 +32,7 @@ use crate::checkers::ast::Checker;
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: Await expression](https://docs.python.org/3/reference/expressions.html#await)
|
/// - [Python documentation: Await expression](https://docs.python.org/3/reference/expressions.html#await)
|
||||||
/// - [PEP 492](https://peps.python.org/pep-0492/#await-expression)
|
/// - [PEP 492: Await Expression](https://peps.python.org/pep-0492/#await-expression)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct AwaitOutsideAsync;
|
pub struct AwaitOutsideAsync;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ const BIDI_UNICODE: [char; 10] = [
|
||||||
'\u{2068}', //{FIRST STRONG ISOLATE}
|
'\u{2068}', //{FIRST STRONG ISOLATE}
|
||||||
'\u{2069}', //{POP DIRECTIONAL ISOLATE}
|
'\u{2069}', //{POP DIRECTIONAL ISOLATE}
|
||||||
// The following was part of PEP 672:
|
// The following was part of PEP 672:
|
||||||
// https://www.python.org/dev/peps/pep-0672/
|
// https://peps.python.org/pep-0672/
|
||||||
// so the list above might not be complete
|
// so the list above might not be complete
|
||||||
'\u{200F}', //{RIGHT-TO-LEFT MARK}
|
'\u{200F}', //{RIGHT-TO-LEFT MARK}
|
||||||
// We don't use
|
// We don't use
|
||||||
|
@ -40,7 +40,7 @@ const BIDI_UNICODE: [char; 10] = [
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 672](https://peps.python.org/pep-0672/#bidirectional-text)
|
/// - [PEP 672: Bidirectional Text](https://peps.python.org/pep-0672/#bidirectional-text)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct BidirectionalUnicode;
|
pub struct BidirectionalUnicode;
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ use crate::fix::snippet::SourceCodeSnippet;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: max function](https://docs.python.org/3/library/functions.html#max)
|
/// - [Python documentation: `max`](https://docs.python.org/3/library/functions.html#max)
|
||||||
/// - [Python documentation: min function](https://docs.python.org/3/library/functions.html#min)
|
/// - [Python documentation: `min`](https://docs.python.org/3/library/functions.html#min)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct IfStmtMinMax {
|
pub struct IfStmtMinMax {
|
||||||
min_max: MinMax,
|
min_max: MinMax,
|
||||||
|
|
|
@ -46,8 +46,8 @@ use crate::checkers::ast::Checker;
|
||||||
/// - [PEP 8: Naming Conventions](https://peps.python.org/pep-0008/#naming-conventions)
|
/// - [PEP 8: Naming Conventions](https://peps.python.org/pep-0008/#naming-conventions)
|
||||||
/// - [Semantic Versioning](https://semver.org/)
|
/// - [Semantic Versioning](https://semver.org/)
|
||||||
///
|
///
|
||||||
/// [PEP 8]: https://www.python.org/dev/peps/pep-0008/
|
/// [PEP 8]: https://peps.python.org/pep-0008/
|
||||||
/// [PEP 420]: https://www.python.org/dev/peps/pep-0420/
|
/// [PEP 420]: https://peps.python.org/pep-0420/
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct ImportPrivateName {
|
pub struct ImportPrivateName {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -9,7 +9,8 @@ use ruff_text_size::Ranged;
|
||||||
/// Checks for import statements that import the current module.
|
/// Checks for import statements that import the current module.
|
||||||
///
|
///
|
||||||
/// ## Why is this bad?
|
/// ## Why is this bad?
|
||||||
/// Importing a module from itself is a circular dependency.
|
/// Importing a module from itself is a circular dependency and results
|
||||||
|
/// in an `ImportError` exception.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
///
|
///
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ## Why is this bad?
|
/// ## Why is this bad?
|
||||||
/// The `global` declaration applies to the entire scope. Using a name that's
|
/// The `global` declaration applies to the entire scope. Using a name that's
|
||||||
/// declared as `global` in a given scope prior to the relevant `global`
|
/// declared as `global` in a given scope prior to the relevant `global`
|
||||||
/// declaration is a syntax error.
|
/// declaration is a `SyntaxError`.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
|
|
|
@ -28,6 +28,15 @@ use crate::checkers::ast::Checker;
|
||||||
/// def greeting():
|
/// def greeting():
|
||||||
/// print("Greetings friend!")
|
/// print("Greetings friend!")
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// or
|
||||||
|
///
|
||||||
|
/// ```python
|
||||||
|
/// class Person:
|
||||||
|
/// @staticmethod
|
||||||
|
/// def greeting():
|
||||||
|
/// print("Greetings friend!")
|
||||||
|
/// ```
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct NoSelfUse {
|
pub struct NoSelfUse {
|
||||||
method_name: String,
|
method_name: String,
|
||||||
|
|
|
@ -27,7 +27,7 @@ use ruff_macros::{derive_message_formats, violation};
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: The `nonlocal` statement](https://docs.python.org/3/reference/simple_stmts.html#nonlocal)
|
/// - [Python documentation: The `nonlocal` statement](https://docs.python.org/3/reference/simple_stmts.html#nonlocal)
|
||||||
/// - [PEP 3104](https://peps.python.org/pep-3104/)
|
/// - [PEP 3104 – Access to Names in Outer Scopes](https://peps.python.org/pep-3104/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct NonlocalWithoutBinding {
|
pub struct NonlocalWithoutBinding {
|
||||||
pub(crate) name: String,
|
pub(crate) name: String,
|
||||||
|
|
|
@ -41,7 +41,7 @@ use crate::rules::pylint::helpers::type_param_name;
|
||||||
/// - [PEP 483 – The Theory of Type Hints: Covariance and Contravariance](https://peps.python.org/pep-0483/#covariance-and-contravariance)
|
/// - [PEP 483 – The Theory of Type Hints: Covariance and Contravariance](https://peps.python.org/pep-0483/#covariance-and-contravariance)
|
||||||
/// - [PEP 484 – Type Hints: Covariance and contravariance](https://peps.python.org/pep-0484/#covariance-and-contravariance)
|
/// - [PEP 484 – Type Hints: Covariance and contravariance](https://peps.python.org/pep-0484/#covariance-and-contravariance)
|
||||||
///
|
///
|
||||||
/// [PEP 484]: https://www.python.org/dev/peps/pep-0484/
|
/// [PEP 484]: https://peps.python.org/pep-0484/
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct TypeNameIncorrectVariance {
|
pub struct TypeNameIncorrectVariance {
|
||||||
kind: VarKind,
|
kind: VarKind,
|
||||||
|
|
|
@ -21,6 +21,12 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```python
|
/// ```python
|
||||||
/// import numpy as np
|
/// import numpy as np
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// or
|
||||||
|
///
|
||||||
|
/// ```python
|
||||||
|
/// import numpy
|
||||||
|
/// ```
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UselessImportAlias;
|
pub struct UselessImportAlias;
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 563](https://peps.python.org/pep-0563/)
|
/// - [PEP 563 – Postponed Evaluation of Annotations](https://peps.python.org/pep-0563/)
|
||||||
/// - [Python documentation: `__future__`](https://docs.python.org/3/library/__future__.html#module-__future__)
|
/// - [Python documentation: `__future__`](https://docs.python.org/3/library/__future__.html#module-__future__)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct QuotedAnnotation;
|
pub struct QuotedAnnotation;
|
||||||
|
|
|
@ -45,11 +45,10 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
///
|
|
||||||
/// - [PEP 696 – Type Defaults for Type Parameters](https://peps.python.org/pep-0696/)
|
/// - [PEP 696 – Type Defaults for Type Parameters](https://peps.python.org/pep-0696/)
|
||||||
/// - [Annotating generators and coroutines](https://docs.python.org/3.13/library/typing.html#annotating-generators-and-coroutines)
|
/// - [Annotating generators and coroutines](https://docs.python.org/3/library/typing.html#annotating-generators-and-coroutines)
|
||||||
/// - [typing.Generator](https://docs.python.org/3.13/library/typing.html#typing.Generator)
|
/// - [Python documentation: `typing.Generator`](https://docs.python.org/3/library/typing.html#typing.Generator)
|
||||||
/// - [typing.AsyncGenerator](https://docs.python.org/3.13/library/typing.html#typing.AsyncGenerator)
|
/// - [Python documentation: `typing.AsyncGenerator`](https://docs.python.org/3/library/typing.html#typing.AsyncGenerator)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UnnecessaryDefaultTypeArgs;
|
pub struct UnnecessaryDefaultTypeArgs;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ use crate::fix;
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 3115](https://www.python.org/dev/peps/pep-3115/)
|
/// - [PEP 3115 – Metaclasses in Python 3000](https://peps.python.org/pep-3115/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UselessMetaclassType;
|
pub struct UselessMetaclassType;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ use crate::fix::edits::{remove_argument, Parentheses};
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [PEP 3115](https://www.python.org/dev/peps/pep-3115/)
|
/// - [PEP 3115 – Metaclasses in Python 3000](https://peps.python.org/pep-3115/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct UselessObjectInheritance {
|
pub struct UselessObjectInheritance {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
|
@ -36,7 +36,7 @@ use crate::checkers::ast::Checker;
|
||||||
///
|
///
|
||||||
/// ## References
|
/// ## References
|
||||||
/// - [Python documentation: The `yield` statement](https://docs.python.org/3/reference/simple_stmts.html#the-yield-statement)
|
/// - [Python documentation: The `yield` statement](https://docs.python.org/3/reference/simple_stmts.html#the-yield-statement)
|
||||||
/// - [PEP 380](https://peps.python.org/pep-0380/)
|
/// - [PEP 380 – Syntax for Delegating to a Subgenerator](https://peps.python.org/pep-0380/)
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct YieldInForLoop;
|
pub struct YieldInForLoop;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue