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

Deprecated checker is not able to detect deprecated aliases to existing functions/methods #4618

Closed
matusvalo opened this issue Jun 27, 2021 · 0 comments · Fixed by #4619
Closed
Assignees
Labels
Enhancement ✨ Improvement to a component False Negative 🦋 No message is emitted but something is wrong with the code

Comments

@matusvalo
Copy link
Collaborator

matusvalo commented Jun 27, 2021

Steps to reproduce

Module threading contains several deprecated aliases (deprecated in python 3.7 and 3.10) of existing functions:

  • threading.Thread.isAlive
  • threading.currentThread
  • threading.activeCount
  • threading.Condition.notifyAll
  • threading.Event.isSet
  • threading.Thread.setName
  • threading.thread.getName
  • threading.Thread.isDaemon
  • threading.Thread.setDaemon

Current logic of detecting deprecated methods/functions does not support aliases since it is using inferred name of function for checking against list of deprecated names. Hence, even after adding the names to list of deprecated functions, pylint produces false negative result:

Given a file a.py:

import threading

print(threading.currentThread())

Current behavior

$ pylint test.py

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

Expected behavior

$ pylint test.py
************* Module test
test.py:51:6: W1505: Using deprecated method currentThread() (deprecated-method)

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

pylint --version output

Result of pylint --version output:

$ pylint --version
pylint 2.9.0-dev1
astroid 2.6.0
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0]
@matusvalo matusvalo changed the title Deprecated checker is not able deprecated aliases to existing functions/methods Deprecated checker is not able to detect deprecated aliases to existing functions/methods Jun 27, 2021
@Pierre-Sassoulas Pierre-Sassoulas added Enhancement ✨ Improvement to a component False Negative 🦋 No message is emitted but something is wrong with the code labels Jun 27, 2021
@matusvalo matusvalo reopened this Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component False Negative 🦋 No message is emitted but something is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants