Visitar URL original
Remove decorators named validator and root_validator from B902 checks by natemcmaster · Pull Request #459 · PyCQA/flake8-bugbear · GitHub
Skip to content

Remove decorators named validator and root_validator from B902 checks - #459

Merged
cooperlees merged 1 commit into
PyCQA:mainfrom
natemcmaster:b902-no-validator
Feb 7, 2024
Merged

cooperlees merged 1 commit into
PyCQA:mainfrom
natemcmaster:b902-no-validator

Conversation

@natemcmaster

@natemcmaster natemcmaster commented Feb 5, 2024 •

Copy link
Copy Markdown
Contributor

What

This removes methods named validator and root_validator from the B902 check

Why

Fixes #413

Removes false positives for common cases, like using attrs validators

Testing

ran tox and all tests are passing

@natemcmaster
natemcmaster marked this pull request as ready for review February 5, 2024 01:19

@jakkdl jakkdl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In hindsight I should've added methods to tests/b902.py with @validator and @root_validator to check that the defaults were properly parsed. You could perhaps add those now and mark them as failing in tests.test_bugbear.test_b902, but /shrug.

If I could approve the test run I would. I know @Zac-HD likes championing for only requiring approval for test runs if first-time contributors are new to github, as opposed to default where all first-time project contributors require approvals.

Comment thread DEVELOPMENT.md
```console
cd flake8-bugbear
/path/to/venv/bin/pip install -e .[dev]
/path/to/venv/bin/pip install -e '.[dev]'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only required in some shells (zsh in particular) afaik, but doesn't hurt in other shells, so seems fine to bundle in what's otherwise an unrelated PR.

@cooperlees cooperlees left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it so.

@cooperlees
cooperlees merged commit 5c3f0bd into PyCQA:main Feb 7, 2024
@natemcmaster
natemcmaster deleted the b902-no-validator branch February 19, 2024 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

B902: False positive when using the attrs library

3 participants