Skip to content

Improve node info for invalid-name #5094

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 2 commits into from
Oct 5, 2021

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Sep 29, 2021

Description

At the moment invalid-name for a function argument is emitted on the function node. That does work, however it limits where pylint: disable can be set. Consider the following example:

class SomeClass:
    def func(
        self,
        var,
        invalidName,
    ):
        pass

Only invalidName is wrong. With this change it's now possible to add pylint: disable directly behind it instead of after def func.

This appears to be fully backwards compatible. I.e. both with disable invalid-name:

# old
class SomeClass:
    def func(  # pylint: disable=invalid-name
        self,
        var,
        invalidName,
    ):
        pass

# new
class SomeClass:
    def func(
        self,
        var,
        invalidName,  # pylint: disable=invalid-name
    ):
        pass

@cdce8p
Copy link
Member Author

cdce8p commented Sep 29, 2021

I would like to target 2.11.2 for this one if thats ok.

@coveralls
Copy link

coveralls commented Sep 29, 2021

Pull Request Test Coverage Report for Build 1308371750

  • 3 of 4 (75.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.114%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pylint/checkers/base.py 3 4 75.0%
Totals Coverage Status
Change from base Build 1307547189: 0.0%
Covered Lines: 13400
Relevant Lines: 14391

💛 - Coveralls

@cdce8p cdce8p force-pushed the enh_invalid-name-node branch from 906cec7 to 72a0f2e Compare September 29, 2021 12:52
@Pierre-Sassoulas
Copy link
Member

I would like to target 2.11.2 for this one if that's ok.

This does not feel like a "fix" but so does all the typing we already added in 2.11.2. I feel like we have already a lot in 2.11.2 and could practically release 2.12 instead at this point.

@cdce8p
Copy link
Member Author

cdce8p commented Sep 29, 2021

This does not feel like a "fix" but so does all the typing we already added in 2.11.2. I feel like we have already a lot in 2.11.2 and could practically release 2.12 instead at this point.

That might indeed be the better solution 😅
Technically it is a new feature, but since it's fully backwards compatible it could be ok.

@cdce8p cdce8p added the Enhancement ✨ Improvement to a component label Sep 29, 2021
@cdce8p cdce8p added this to the 2.12.0 milestone Oct 5, 2021
@cdce8p cdce8p force-pushed the enh_invalid-name-node branch from ad2727f to dae53cd Compare October 5, 2021 16:02
@cdce8p cdce8p merged commit 17ddcf4 into pylint-dev:main Oct 5, 2021
@cdce8p cdce8p deleted the enh_invalid-name-node branch October 5, 2021 16:14
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.

3 participants