Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flake8 bugbear to pre-commit #7697

Merged

Conversation

Pierre-Sassoulas
Copy link
Member

Type of Changes

Type
βœ“ πŸ”¨ Refactoring

Description

I realized that flake8-bugbear was configured in astroid but not pylint when upgrading pre-commit. Generally it's the other way around. There were some fixes to do, some of them valuable.

@Pierre-Sassoulas Pierre-Sassoulas added Maintenance Discussion or action around maintaining pylint or the dev workflow Skip news πŸ”‡ This change does not require a changelog entry labels Nov 1, 2022
@coveralls
Copy link

coveralls commented Nov 1, 2022

Pull Request Test Coverage Report for Build 3372880403

  • 9 of 9 (100.0%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 95.38%

Totals Coverage Status
Change from base Build 3367355028: -0.001%
Covered Lines: 17237
Relevant Lines: 18072

πŸ’› - Coveralls

@github-actions

This comment has been minimized.

pylint/checkers/strings.py Outdated Show resolved Hide resolved
@@ -529,7 +529,7 @@ def visit_default(self, node: nodes.NodeNG) -> None:
tolineno = node.tolineno
assert tolineno, node
lines: list[str] = []
for line in range(line, tolineno + 1):
for line in range(line, tolineno + 1): # noqa: B020
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the warning here?

Copy link
Member Author

Choose a reason for hiding this comment

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

'Loop control variable overrides iterable it iterates' (It's by design)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure? Can't for line be for index?
The iterable value just seems to be a integer that's called line.

Copy link
Member Author

@Pierre-Sassoulas Pierre-Sassoulas Nov 4, 2022

Choose a reason for hiding this comment

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

I'd rather not touch this, my goal is to add flake8 bugbear not "fix" all legacy issues (especially when the fix is not trivial and the code is working well).

pylint/checkers/typecheck.py Show resolved Hide resolved
@Pierre-Sassoulas
Copy link
Member Author

I don't have the time to fix everything, could we merge with the current disable so flake8 bugbear is applied on new code and the already working code stay as is ? In particular fixing dummy-variables-rgx seems 4 hours of work or more. Polishing working code we don't understand well means we can introduce bugs that we'll have to fix later.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2022

πŸ€– Effect of this PR on checked open source code: πŸ€–

Effect on pytest:
The following messages are now emitted:

  1. inconsistent-return-statements:
    Either all return statements in a function should return an expression, or none of them should.
    https://github.com/pytest-dev/pytest/blob/50b232b0cb39490776da2658ae69c669ce263050/src/_pytest/pytester.py#L301
  2. no-name-in-module:
    No name 'NOSE_SUPPORT_METHOD' in module '_pytest.deprecated'
    https://github.com/pytest-dev/pytest/blob/50b232b0cb39490776da2658ae69c669ce263050/src/_pytest/python.py#L62
  3. no-name-in-module:
    No name 'PytestReturnNotNoneWarning' in module '_pytest.warning_types'
    https://github.com/pytest-dev/pytest/blob/50b232b0cb39490776da2658ae69c669ce263050/src/_pytest/python.py#L81
  4. inconsistent-return-statements:
    Either all return statements in a function should return an expression, or none of them should.
    https://github.com/pytest-dev/pytest/blob/50b232b0cb39490776da2658ae69c669ce263050/src/_pytest/python.py#L1085
  5. inconsistent-return-statements:
    Either all return statements in a function should return an expression, or none of them should.
    https://github.com/pytest-dev/pytest/blob/50b232b0cb39490776da2658ae69c669ce263050/src/_pytest/fixtures.py#L130
  6. inconsistent-return-statements:
    Either all return statements in a function should return an expression, or none of them should.
    https://github.com/pytest-dev/pytest/blob/50b232b0cb39490776da2658ae69c669ce263050/src/_pytest/python_api.py#L798
  7. no-name-in-module:
    No name 'NOSE_SUPPORT' in module '_pytest.deprecated'
    https://github.com/pytest-dev/pytest/blob/50b232b0cb39490776da2658ae69c669ce263050/src/_pytest/nose.py#L5
  8. no-name-in-module:
    No name 'warn_explicit_for' in module '_pytest.warning_types'
    https://github.com/pytest-dev/pytest/blob/50b232b0cb39490776da2658ae69c669ce263050/src/_pytest/config/__init__.py#L62
  9. no-member:
    Module '_pytest.deprecated' has no 'HOOK_LEGACY_MARKING' member
    https://github.com/pytest-dev/pytest/blob/50b232b0cb39490776da2658ae69c669ce263050/src/_pytest/config/__init__.py#L369

This comment was generated for commit 266c0f5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Discussion or action around maintaining pylint or the dev workflow Skip news πŸ”‡ This change does not require a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants