Skip to content

Handle ComprehensionScope and their behaviour better #5923

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

Merged
merged 3 commits into from
Mar 15, 2022

Conversation

DanielNoord
Copy link
Collaborator

  • Add yourself to CONTRIBUTORS.txt if you are a new contributor.
  • Write a good description on what the PR does.

Type of Changes

Type
βœ“ πŸ› Bug fix
βœ“ πŸ”¨ Refactoring

Description

Refactoring necessary for pylint-dev/astroid#1475 to be "acceptable" for pylint.

Note that the change to names_hint = ", ".join(names) might be unrelated, but I couldn't get pre-commit to pass without it and I wanted to show that if you clone pylint-dev/astroid#1475 and these changes then both test suites should pass.

@DanielNoord DanielNoord added Enhancement ✨ Improvement to a component Maintenance Discussion or action around maintaining pylint or the dev workflow labels Mar 15, 2022
@coveralls
Copy link

coveralls commented Mar 15, 2022

Pull Request Test Coverage Report for Build 1988874403

  • 7 of 9 (77.78%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 94.078%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pylint/checkers/classes/special_methods_checker.py 1 2 50.0%
pylint/checkers/utils.py 1 2 50.0%
Totals Coverage Status
Change from base Build 1986048864: -0.01%
Covered Lines: 15188
Relevant Lines: 16144

πŸ’› - Coveralls

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.14.0 milestone Mar 15, 2022
@DanielNoord
Copy link
Collaborator Author

@Pierre-Sassoulas I didn't expect this, but the tests seem to pass (with expected drop in coverage). If we can get confirmation on the approach taken in pylint-dev/astroid#1475 we can get this in 2.13.x as a hot fix and actually fix astroid's CI before merging the fix there πŸ˜„

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.

I think we could merge directly for 2.13.0, after investigation of the coverage change ? Imo the code in pylint never considered that the comprehension scope could be something else than uninferrable because it never was, but this is not a voluntary design choice.

@DanielNoord
Copy link
Collaborator Author

I think we could merge directly for 2.13.0, after investigation of the coverage change ? Imo the code in pylint never considered that the comprehension scope could be something else than uninferrable because it never was, but this is not a voluntary design choice.

The coverage change is just two if statements for ComprehensionScope that will be covered when the change lands in astroid. So they are as expected.

@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.14.0, 2.13.0 Mar 15, 2022
@DanielNoord
Copy link
Collaborator Author

@Pierre-Sassoulas I have added some TODOs so that if for some unforeseen reason we don't merge the astroid PR we know why this is uncovered (and what we should do with it).

@Pierre-Sassoulas Pierre-Sassoulas merged commit 0481a73 into pylint-dev:main Mar 15, 2022
@DanielNoord DanielNoord deleted the dict branch March 15, 2022 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component Maintenance Discussion or action around maintaining pylint or the dev workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants