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 deprecated-method false positive #7795

Merged
merged 2 commits into from
Nov 19, 2022

Conversation

clavedeluna
Copy link
Collaborator

@clavedeluna clavedeluna commented Nov 18, 2022

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Original PR that added this code https://github.com/PyCQA/pylint/pull/4619/files
it seems that the unit test that was added led the code, which is a good practice, except I believe the unit test itself was incorrect and confused the naming of deprecated_method. This wasn't a necessary change at all, and in fact led to a false positive.

Closes #5886

@coveralls
Copy link

coveralls commented Nov 18, 2022

Pull Request Test Coverage Report for Build 3498044805

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.0005%) to 95.413%

Totals Coverage Status
Change from base Build 3495970943: -0.0005%
Covered Lines: 17389
Relevant Lines: 18225

πŸ’› - Coveralls

@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code backport maintenance/2.15.x labels Nov 18, 2022
@github-actions
Copy link
Contributor

πŸ€– According to the primer, this change has no effect on the checked open source code. πŸ€–πŸŽ‰

This comment was generated for commit 2703b2d

Copy link
Member

@jacobtylerwalls jacobtylerwalls left a comment

Choose a reason for hiding this comment

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

Thank you! Makes sense. Test fails without the fix. Original issue that motivated the other PR still works:

$ cat a.py
import threading

print(threading.currentThread())

$ pylint a
************* Module a
a.py:3:6: W4902: Using deprecated method currentThread() (deprecated-method)

------------------------------------------------------------------
Your code has been rated at 5.00/10 (previous run: 5.00/10, +0.00)

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.15.7 milestone Nov 19, 2022
@Pierre-Sassoulas Pierre-Sassoulas added the Blocked 🚧 Blocked by a particular issue label Nov 19, 2022
@Pierre-Sassoulas
Copy link
Member

(kinda) blocked by #7800, I'd like to test the new workflow with this if possible.

@Pierre-Sassoulas Pierre-Sassoulas added Blocked 🚧 Blocked by a particular issue and removed Blocked 🚧 Blocked by a particular issue labels Nov 19, 2022
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.

πŸ‘

@Pierre-Sassoulas Pierre-Sassoulas merged commit 57f38c3 into pylint-dev:main Nov 19, 2022
github-actions bot pushed a commit that referenced this pull request Nov 19, 2022
When alias for method is similar to name of deprecated method.

Closes #5886

(cherry picked from commit 57f38c3)
@jacobtylerwalls
Copy link
Member

jacobtylerwalls commented Nov 20, 2022

@clavedeluna This PR is emitting a warning in the test suite. Would you be available to take a look? See run.

  /opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/contextlib.py:142: DeprecationWarning: The end_col_offset attribute of MessageTest(msg_id='deprecated-method', line=9, node=<Call l.9 at 0x7ff5adaa3b50>, args=('new_name',), confidence=Confidence(name='UNDEFINED', description='Warning without any associated confidence level.'), col_offset=0, end_line=9, end_col_offset=12) does not match the expected value in MessageTest(msg_id='deprecated-method', line=9, node=<Call l.9 at 0x7ff5adaa3b50>, args=('new_name',), confidence=Confidence(name='UNDEFINED', description='Warning without any associated confidence level.'), col_offset=0, end_line=9, end_col_offset=21). In pylint 3.0 correct end_col_offset attributes will be required for MessageTest.

Pierre-Sassoulas pushed a commit that referenced this pull request Nov 22, 2022
When alias for method is similar to name of deprecated method.

Closes #5886

(cherry picked from commit 57f38c3)
Pierre-Sassoulas pushed a commit that referenced this pull request Nov 23, 2022
When alias for method is similar to name of deprecated method.

Closes #5886

(cherry picked from commit 57f38c3)
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 deprecated-method with alias to non-deprecated method
4 participants