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 #5370: Emit redefined-outer-name when a nested except handler shadows an outer one #5630

Merged

Conversation

jacobtylerwalls
Copy link
Member

@jacobtylerwalls jacobtylerwalls commented Jan 3, 2022

Type of Changes

Type
✨ New feature

Description

Emit redefined-outer-name when a nested except handler shadows (overwrites) the name used in an outer except handler.

Implementation borrows from the redefined-outer-name implementation for if branches.

Closes #5370, Closes #4434

@coveralls
Copy link

coveralls commented Jan 3, 2022

Pull Request Test Coverage Report for Build 1649860076

  • 15 of 15 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 93.701%

Totals Coverage Status
Change from base Build 1647269448: 0.006%
Covered Lines: 14354
Relevant Lines: 15319

💛 - Coveralls

@Pierre-Sassoulas Pierre-Sassoulas added the Enhancement ✨ Improvement to a component label Jan 3, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.0 milestone Jan 3, 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.

Already looks good, thank you @jacobtylerwalls !

ChangeLog Show resolved Hide resolved
doc/whatsnew/2.13.rst Show resolved Hide resolved
pylint/checkers/variables.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

Thanks once again @jacobtylerwalls!

I feel like you have a New Years resolution of leaving no used-before-assignment and redefined-outer-name unfixed in 2022 😄

tests/functional/r/redefined_except_handler.py Outdated Show resolved Hide resolved
pylint/checkers/variables.py Outdated Show resolved Hide resolved
jacobtylerwalls and others added 4 commits January 3, 2022 09:11
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
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.

Perfect, thanks ! (I guess this is also going to be an inspiration for fixing #4391)

@Pierre-Sassoulas Pierre-Sassoulas merged commit 619d853 into pylint-dev:main Jan 3, 2022
@jacobtylerwalls jacobtylerwalls deleted the nested-except-shadows branch January 3, 2022 19:51
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
4 participants