From ec0249b01254de9c71c38ca843bbeffc0fbb27c2 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Sun, 4 Feb 2024 17:16:08 -0800 Subject: [PATCH] Remove decorators named validator and root_validator from B902 checks --- DEVELOPMENT.md | 2 +- README.rst | 2 +- bugbear.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 7d81dd4..6ebde17 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -39,7 +39,7 @@ python3 -m venv /path/to/venv ```console cd flake8-bugbear -/path/to/venv/bin/pip install -e .[dev] +/path/to/venv/bin/pip install -e '.[dev]' ``` ## Running Tests diff --git a/README.rst b/README.rst index 4d31f0f..914147c 100644 --- a/README.rst +++ b/README.rst @@ -315,7 +315,7 @@ This could be useful, when using other libraries that provide more immutable cal beside those already handled by ``flake8-bugbear``. Calls to these method will no longer raise a ``B008`` warning. -``classmethod-decorators``: Specify a list of decorators to additionally mark a method as a ``classmethod`` as used by B902. Default values are ``classmethod, validator, root_validator``, and when an ``@obj.name`` decorator is specified it will match against either ``name`` or ``obj.name``. +``classmethod-decorators``: Specify a list of decorators to additionally mark a method as a ``classmethod`` as used by B902. The default only checks for ``classmethod``. When an ``@obj.name`` decorator is specified it will match against either ``name`` or ``obj.name``. This functions similarly to how `pep8-naming ` handles it, but with different defaults, and they don't support specifying attributes such that a decorator will never match against a specified value ``obj.name`` even if decorated with ``@obj.name``. For example:: diff --git a/bugbear.py b/bugbear.py index 918efba..485a8e9 100644 --- a/bugbear.py +++ b/bugbear.py @@ -41,7 +41,7 @@ "assertWarnsRegex", } -B902_default_decorators = {"classmethod", "validator", "root_validator"} +B902_default_decorators = {"classmethod"} Context = namedtuple("Context", ["node", "stack"])