-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add deprecated-attribute
message
#8855
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
Comments
@jacobtylerwalls Can I work on this ? |
Sure thing! Feel free to open a draft PR if you have questions about something along the way. |
@jacobtylerwalls Can you just sum up what all has to be done ? |
Sure, you should take a look at the implementation of the other You'll probably need to trigger your check from |
@jacobtylerwalls So till now what I have figured out is that: 1.DEPRECATED_ATTRIBUTE_MESSAGE = { Can you tell is right ? |
Yep sounds right! |
@jacobtylerwalls In the file "typecheck.py," the function "visit_attributes()" will also be modified because there are multiple functions with the same name in different files. I wanted to confirm with you if this understanding is correct. |
That doesn't sound quite right, I think only the visit_attribute() method needs changing in the file with the deprecation checker. If it doesn't exist you'll need to create it (it's an override). |
@jacobtylerwalls "deprecated.py" In this file, there is no definition of 'visit_attributes()' method. I suppose I have to create it then? |
Or are you talking about the visit_attributes() method in the "class_checker.py" file ? |
Yes, this is needed. No "s" at the end of attribute. If you check the parent classes you'll see it's an override. |
Wrote it by mistake . So I have to create a method with this name in deprecated.py as it is not there ? |
Right, it will have the same signature as in the parent class. |
Okay got it !! |
@jacobtylerwalls Like I have made changes in the deprected.py I want to test them how can I test them and know if the changes are right or not. Like do I have to create a python file and then give to pylint something like that ? |
You can take a look at https://pylint.readthedocs.io/en/stable/development_guide/contributor_guide/tests/index.html for those topics. |
@jacobtylerwalls For adding the test for the "attrribute" do we also need to update the "check_deprecate_method" or the other related methods because I am running a command "python -m pytest unittest_deprecated.py" and my 4 test are failing .Can you guide me little bit? |
At this point a draft PR would be easier to talk over, provides more info than a screen shot 👍 |
Ok will draft soon |
Can you review it I accidently got some whitespace and all but can you review the logic ? |
New Features ------------ - Skip ``consider-using-join`` check for non-empty separators if an ``suggest-join-with-non-empty-separator`` option is set to ``no``. Closes #8701 (`#8701 <https://github.com/pylint-dev/pylint/issues/8701>`_) - Discover ``.pyi`` files when linting. These can be ignored with the ``ignore-patterns`` setting. Closes #9097 (`#9097 <https://github.com/pylint-dev/pylint/issues/9097>`_) - Check ``TypeAlias`` and ``TypeVar`` (PEP 695) nodes for ``invalid-name``. Refs #9196 (`#9196 <https://github.com/pylint-dev/pylint/issues/9196>`_) - Support for resolving external toml files named pylintrc.toml and .pylintrc.toml. Closes #9228 (`#9228 <https://github.com/pylint-dev/pylint/issues/9228>`_) - Check for `.clear`, `.discard`, `.pop` and `remove` methods being called on a set while it is being iterated over. Closes #9334 (`#9334 <https://github.com/pylint-dev/pylint/issues/9334>`_) New Checks ---------- - New message `use-yield-from` added to the refactoring checker. This message is emitted when yielding from a loop can be replaced by `yield from`. Closes #9229. (`#9229 <https://github.com/pylint-dev/pylint/issues/9229>`_) - Added a ``deprecated-attribute`` message to check deprecated attributes in the stdlib. Closes #8855 (`#8855 <https://github.com/pylint-dev/pylint/issues/8855>`_) False Positives Fixed --------------------- - Fixed false positive for ``inherit-non-class`` for generic Protocols. Closes #9106 (`#9106 <https://github.com/pylint-dev/pylint/issues/9106>`_) - Exempt ``TypedDict`` from ``typing_extensions`` from ``too-many-ancestor`` checks. Refs #9167 (`#9167 <https://github.com/pylint-dev/pylint/issues/9167>`_) False Negatives Fixed --------------------- - Extend broad-exception-raised and broad-exception-caught to except*. Closes #8827 (`#8827 <https://github.com/pylint-dev/pylint/issues/8827>`_) - Fix a false-negative for unnecessary if blocks using a different than expected ordering of arguments. Closes #8947. (`#8947 <https://github.com/pylint-dev/pylint/issues/8947>`_) Other Bug Fixes --------------- - Improve the message provided for wrong-import-order check. Instead of the import statement ("import x"), the message now specifies the import that is out of order and which imports should come after it. As reported in the issue, this is particularly helpful if there are multiple imports on a single line that do not follow the PEP8 convention. The message will report imports as follows: For "import X", it will report "(standard/third party/first party/local) import X" For "import X.Y" and "from X import Y", it will report "(standard/third party/first party/local) import X.Y" The import category is specified to provide explanation as to why pylint has issued the message and guidence to the developer on how to fix the problem. Closes #8808 (`#8808 <https://github.com/pylint-dev/pylint/issues/8808>`_) Other Changes ------------- - Print how many files were checked in verbose mode. Closes #8935 (`#8935 <https://github.com/pylint-dev/pylint/issues/8935>`_) - Fix a crash when an enum class which is also decorated with a ``dataclasses.dataclass`` decorator is defined. Closes #9100 (`#9100 <https://github.com/pylint-dev/pylint/issues/9100>`_)
Current problem
Similar to
deprecated-method
, we could havedeprecated-attribute
to warn for uses like this:Desired solution
deprecated-attribute
message and then add attributes that were missed from python what's new documents, such as in 3.12:Additional context
The generator changes might be difficult to make, but the
sys
ones would be easy and high value because they were deprecated only in docs, not with code warnings.The text was updated successfully, but these errors were encountered: