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

Rename unneeded-not to unnecessary-negation for clarity #8846

Merged
merged 10 commits into from
Aug 6, 2023

Conversation

gracejiang16
Copy link
Contributor

@gracejiang16 gracejiang16 commented Jul 12, 2023

Rename 'unneeded-not' to 'unnecessary-negation.' Deprecate old name.

Type of Changes

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

Description

Closes #8789

@github-actions

This comment has been minimized.

@gracejiang16 gracejiang16 changed the title renamed unneeded-not fix unneeded-not #8789 Jul 12, 2023
@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Merging #8846 (1c9a98b) into main (e71f63b) will decrease coverage by 0.14%.
Report is 52 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8846      +/-   ##
==========================================
- Coverage   95.88%   95.74%   -0.14%     
==========================================
  Files         173      173              
  Lines       18548    18557       +9     
==========================================
- Hits        17785    17768      -17     
- Misses        763      789      +26     
Files Changed Coverage Ξ”
pylint/checkers/refactoring/not_checker.py 97.22% <100.00%> (ΓΈ)

... and 13 files with indirect coverage changes

@github-actions

This comment has been minimized.

@Pierre-Sassoulas Pierre-Sassoulas added the Enhancement ✨ Improvement to a component label Jul 13, 2023
.gitignore Outdated
@@ -4,6 +4,7 @@
/log
*.py[cod]
/build
/venv
Copy link
Member

Choose a reason for hiding this comment

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

You can use a global gitignore for that :)

"""This is also ok"""
def __ne__(self, other):
return not self == other
"""Check exceeding negations in boolean expressions trigger warnings"""
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas Jul 13, 2023

Choose a reason for hiding this comment

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

It's strange that everything changed here, probably due to modified end of line (\r\n vs \n). Could you revert to the original line ending ? It preservs the git blame and we need some diversity in line ending in some of the tests which is why it's not uniformized with a .gitattributes :)

@jacobtylerwalls jacobtylerwalls added this to the 3.0.0a7 milestone Jul 14, 2023
@github-actions

This comment has been minimized.

@jacobtylerwalls jacobtylerwalls changed the title fix unneeded-not #8789 Rename unneeded-not to unnecessary-negation for clarity Aug 6, 2023
@jacobtylerwalls jacobtylerwalls enabled auto-merge (squash) August 6, 2023 02:52
@jacobtylerwalls
Copy link
Member

Thanks for the contribution @gracejiang16!

@jacobtylerwalls jacobtylerwalls merged commit 50f2269 into pylint-dev:main Aug 6, 2023
42 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2023

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

Effect on pandas:
The following messages are now emitted:

  1. locally-disabled:
    Locally disabling unnecessary-negation (C0117)
    https://github.com/pandas-dev/pandas/blob/71a6d53fcf13063b0ca2d817f69035c3cee47c92/pandas/tests/scalar/timedelta/test_arithmetic.py#L1180
  2. suppressed-message:
    Suppressed 'unnecessary-negation' (from line 1180)
    https://github.com/pandas-dev/pandas/blob/71a6d53fcf13063b0ca2d817f69035c3cee47c92/pandas/tests/scalar/timedelta/test_arithmetic.py#L1180
  3. locally-disabled:
    Locally disabling unnecessary-negation (C0117)
    https://github.com/pandas-dev/pandas/blob/71a6d53fcf13063b0ca2d817f69035c3cee47c92/pandas/tests/scalar/timestamp/test_comparisons.py#L312
  4. suppressed-message:
    Suppressed 'unnecessary-negation' (from line 312)
    https://github.com/pandas-dev/pandas/blob/71a6d53fcf13063b0ca2d817f69035c3cee47c92/pandas/tests/scalar/timestamp/test_comparisons.py#L312

The following messages are no longer emitted:

  1. locally-disabled:
    Locally disabling unneeded-not (C0113)
    https://github.com/pandas-dev/pandas/blob/71a6d53fcf13063b0ca2d817f69035c3cee47c92/pandas/tests/scalar/timedelta/test_arithmetic.py#L1180
  2. suppressed-message:
    Suppressed 'unneeded-not' (from line 1180)
    https://github.com/pandas-dev/pandas/blob/71a6d53fcf13063b0ca2d817f69035c3cee47c92/pandas/tests/scalar/timedelta/test_arithmetic.py#L1180
  3. locally-disabled:
    Locally disabling unneeded-not (C0113)
    https://github.com/pandas-dev/pandas/blob/71a6d53fcf13063b0ca2d817f69035c3cee47c92/pandas/tests/scalar/timestamp/test_comparisons.py#L312
  4. suppressed-message:
    Suppressed 'unneeded-not' (from line 312)
    https://github.com/pandas-dev/pandas/blob/71a6d53fcf13063b0ca2d817f69035c3cee47c92/pandas/tests/scalar/timestamp/test_comparisons.py#L312

This comment was generated for commit 1c9a98b

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.

Great work, thank you !

@@ -0,0 +1,3 @@
Renamed the "unneeded-not" error into "unnecessary_negation" to be clearer.
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas Aug 6, 2023

Choose a reason for hiding this comment

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

Suggested change
Renamed the "unneeded-not" error into "unnecessary_negation" to be clearer.
Renamed the "unneeded-not" error into "unnecessary-negation" because it can be raised on comparators too (in a context where the `not` keyword is not used).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor unneeded-not checker
3 participants