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

Fix false positive for arguments-differ #8927

Merged
merged 1 commit into from
Aug 11, 2023

Conversation

mbyrnepr2
Copy link
Member

Type of Changes

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

Description

Fix false positive for arguments-differ when overriding __init_subclass__.

Closes #8919

@mbyrnepr2
Copy link
Member Author

The issue isn't connected to subclassing typing.Generic but rather the fact that the arguments to the subclass's __init_subclass method differ from the parent's __init_subclass__ method. We probably want to exclude these methods from such a check since it is common that these arguments would differ: https://docs.python.org/3/reference/datamodel.html#object.__init_subclass__

@mbyrnepr2 mbyrnepr2 force-pushed the 8919_arguments_differ_fp branch from bab248d to 1ed5665 Compare August 5, 2023 13:46
@mbyrnepr2 mbyrnepr2 added the False Positive 🦟 A message is emitted but nothing is wrong with the code label Aug 5, 2023
@github-actions

This comment has been minimized.

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.

LGTM

@mbyrnepr2 mbyrnepr2 force-pushed the 8919_arguments_differ_fp branch from 1ed5665 to 75dcb6b Compare August 5, 2023 18:23
@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Merging #8927 (595b1a3) into main (18df5d2) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8927   +/-   ##
=======================================
  Coverage   95.74%   95.74%           
=======================================
  Files         173      173           
  Lines       18557    18557           
=======================================
  Hits        17767    17767           
  Misses        790      790           
Files Changed Coverage Ξ”
pylint/checkers/classes/class_checker.py 93.27% <100.00%> (ΓΈ)

@mbyrnepr2
Copy link
Member Author

Something not right with the CI. The failing pypy test is the same one that was failing for 3.8/3.9/3.10 etc. before pulling the main branch. Not sure what that is - pytest cache of results stored in our cache between branch updates? πŸ€”

@github-actions

This comment has been minimized.

@mbyrnepr2 mbyrnepr2 force-pushed the 8919_arguments_differ_fp branch from 75dcb6b to 595b1a3 Compare August 7, 2023 11:05
@mbyrnepr2 mbyrnepr2 added this to the 2.17.6 milestone Aug 7, 2023
@mbyrnepr2 mbyrnepr2 marked this pull request as ready for review August 7, 2023 11:09
@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2023

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

Effect on pytest:
The following messages are no longer emitted:

  1. arguments-differ:
    Variadics removed in overriding 'WarningsRecorder.exit' method
    https://github.com/pytest-dev/pytest/blob/e8a8a5f320ad7a9fc1d58ab74c2425e923634f60/src/_pytest/recwarn.py#L244

Effect on django:
The following messages are no longer emitted:

  1. arguments-differ:
    Variadics removed in overriding 'SimpleTestCase.call' method
    https://github.com/django/django/blob/0f3b1a783dfa36cb23aae0bb954756d0edcd9fc1/django/test/testcases.py#L251

This comment was generated for commit 595b1a3

@mbyrnepr2 mbyrnepr2 merged commit 5e233c5 into pylint-dev:main Aug 11, 2023
@mbyrnepr2 mbyrnepr2 deleted the 8919_arguments_differ_fp branch August 11, 2023 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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: arguments-differ for __init_subclass__ in generic
2 participants