Skip to content

Commit

Permalink
Remove decorators named validator and root_validator from B902 checks (
Browse files Browse the repository at this point in the history
  • Loading branch information
natemcmaster committed Feb 7, 2024
1 parent 64fcdfd commit 5c3f0bd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/PyCQA/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::
Expand Down
2 changes: 1 addition & 1 deletion bugbear.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"assertWarnsRegex",
}

B902_default_decorators = {"classmethod", "validator", "root_validator"}
B902_default_decorators = {"classmethod"}

Context = namedtuple("Context", ["node", "stack"])

Expand Down

0 comments on commit 5c3f0bd

Please sign in to comment.