Skip to content

Conversation

@mbyrnepr2
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix
✨ New feature
βœ“ πŸ”¨ Refactoring
πŸ“œ Docs

Description

Fix a false positive for no-value-for-parameter when a staticmethod is called in a class body.

Closes #9036

@mbyrnepr2 mbyrnepr2 added the False Positive 🦟 A message is emitted but nothing is wrong with the code label Sep 13, 2023
@mbyrnepr2 mbyrnepr2 added this to the 2.17.6 milestone Sep 13, 2023
# includes an implicit `self` argument which is not present in `called.args`.
if (
isinstance(node.frame(), nodes.ClassDef)
and isinstance(node.parent, (nodes.Assign, nodes.AnnAssign))
Copy link
Member Author

@mbyrnepr2 mbyrnepr2 Sep 13, 2023

Choose a reason for hiding this comment

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

This if block was added by me originally. I don't think there was any need to specify that this node was an assignment; i.e. this should be checked also:

class X:
    def func(xx):
        ...
    func("test")

@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Merging #9038 (2f21762) into main (0ac21c7) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #9038   +/-   ##
=======================================
  Coverage   95.75%   95.75%           
=======================================
  Files         173      173           
  Lines       18648    18648           
=======================================
  Hits        17856    17856           
  Misses        792      792           
Files Changed Coverage Ξ”
pylint/checkers/typecheck.py 96.61% <ΓΈ> (ΓΈ)

@mbyrnepr2 mbyrnepr2 marked this pull request as ready for review September 13, 2023 19:42
@github-actions
Copy link
Contributor

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

Effect on psycopg:
The following messages are now emitted:

Details
  1. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/_typeinfo.py#L25
  2. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/pq/_pq_ctypes.py#L56
  3. deprecated-typing-alias:
    'typing.Callable' is deprecated, use 'collections.abc.Callable' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/range.py#L411
  4. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/range.py#L465
  5. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/numeric.py#L366
  6. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/composite.py#L29
  7. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/array.py#L24
  8. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/array.py#L27

The following messages are no longer emitted:

Details
  1. deprecated-typing-alias:
    'typing.Callable' is deprecated, use 'collections.abc.Callable' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/numeric.py#L315
  2. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/enum.py#L25
  3. deprecated-typing-alias:
    'typing.Callable' is deprecated, use 'collections.abc.Callable' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/uuid.py#L18
  4. deprecated-typing-alias:
    'typing.Callable' is deprecated, use 'collections.abc.Callable' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/datetime.py#L24
  5. deprecated-typing-alias:
    'typing.Callable' is deprecated, use 'collections.abc.Callable' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/datetime.py#L25
  6. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/datetime.py#L25
  7. deprecated-typing-alias:
    'typing.Callable' is deprecated, use 'collections.abc.Callable' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/datetime.py#L28
  8. deprecated-typing-alias:
    'typing.Callable' is deprecated, use 'collections.abc.Callable' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/datetime.py#L30
  9. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/psycopg/psycopg/blob/2d3835ae2ba7b270d3ac09da7906d8298274d3a2/psycopg/psycopg/types/datetime.py#L30

Effect on coverage:
The following messages are now emitted:

Details
  1. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/html.py#L80
  2. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/html.py#L648
  3. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/debug.py#L131
  4. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/debug.py#L161
  5. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/debug.py#L389
  6. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/debug.py#L502
  7. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/tomlconfig.py#L70
  8. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/tomlconfig.py#L97
  9. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/tomlconfig.py#L179
  10. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/sqldata.py#L697
  11. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/env.py#L130
  12. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/types.py#L52
  13. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/types.py#L158
  14. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/config.py#L537
  15. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/execfile.py#L42
  16. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/report_core.py#L76
  17. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/plugin_support.py#L200
  18. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/plugin_support.py#L235

The following messages are no longer emitted:

Details
  1. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/control.py#L895
  2. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/control.py#L903
  3. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/files.py#L159
  4. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/files.py#L396
  5. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/phystokens.py#L113
  6. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/results.py#L277
  7. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/results.py#L307
  8. deprecated-typing-alias:
    'typing.Tuple' is deprecated, use 'tuple' instead
    https://github.com/nedbat/coveragepy/blob/68247435407e2cc5f3cb2ab77ae97ae6f5bf9c77/coverage/results.py#L334

This comment was generated for commit 2f21762

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

The primers look convincing :D

@github-actions
Copy link
Contributor

The backport to maintenance/2.17.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-maintenance/2.17.x maintenance/2.17.x
# Navigate to the new working tree
cd .worktrees/backport-maintenance/2.17.x
# Create a new branch
git switch --create backport-9038-to-maintenance/2.17.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 48781fe2c8bbc6f88455c44b5894bb75c873385a
# Push it to GitHub
git push --set-upstream origin backport-9038-to-maintenance/2.17.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-maintenance/2.17.x

Then, create a pull request where the base branch is maintenance/2.17.x and the compare/head branch is backport-9038-to-maintenance/2.17.x.

@Pierre-Sassoulas Pierre-Sassoulas added the Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer label Sep 14, 2023
@mbyrnepr2 mbyrnepr2 deleted the no_value_for_parameter branch September 14, 2023 18:41
@Pierre-Sassoulas Pierre-Sassoulas added Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer backport maintenance/4.0.x labels Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported False Positive 🦟 A message is emitted but nothing is wrong with the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive E1120:no-value-for-parameter

2 participants