Skip to content

Make disable-next only consider the succeeding line#7411

Merged
DanielNoord merged 3 commits intopylint-dev:mainfrom
DanielNoord:disable-next
Sep 5, 2022
Merged

Make disable-next only consider the succeeding line#7411
DanielNoord merged 3 commits intopylint-dev:mainfrom
DanielNoord:disable-next

Conversation

@DanielNoord
Copy link
Copy Markdown
Collaborator

  • Write a good description on what the PR does.
  • Create a news fragment with towncrier create <IssueNumber>.<type> which will be
    included in the changelog. <type> can be one of: new_check, removed_check, extension,
    false_positive, false_negative, bugfix, other, internal. If necessary you can write
    details or offer examples on how the new change is supposed to work.
  • If you used multiple emails or multiple names when contributing, add your mails
    and preferred name in script/.contributors_aliases.json

Type of Changes

Type
🐛 Bug fix

Description

Closes #7401

@DanielNoord DanielNoord added Bug 🪲 Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer C: Pragma's labels Sep 5, 2022
@DanielNoord DanielNoord added this to the 2.15.1 milestone Sep 5, 2022
@coveralls
Copy link
Copy Markdown

coveralls commented Sep 5, 2022

Pull Request Test Coverage Report for Build 2991830942

  • 16 of 16 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 95.333%

Totals Coverage Status
Change from base Build 2989383939: 0.001%
Covered Lines: 16995
Relevant Lines: 17827

💛 - Coveralls

Copy link
Copy Markdown
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.

👌

Comment thread tests/functional/d/disable_msg_next_line.py
@github-actions

This comment has been minimized.

Comment thread pylint/checkers/variables.py Outdated
# pylint: disable-next=too-many-boolean-expressions
if (
not astmts
not astmts # pylint: disable=too-many-boolean-expressions
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Is this an acceptable change in behaviour? I think it is. This seems to be an unintended side effect of checking for block lines that we didn't consider previously.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a way to make disable-next work on the whole if like before ? I think it's going to be reported as a regression, having to change disables when upgrading pylint does not feel great.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not if we also don't want to have the issue reported in the OP. I think it makes sense for disable-next only to work for the next line and I think this is a relatively minor change to have to fix in an auto-update. Obviously it is annoying but let's fix this now while the impact is still relatively minor (compared to a 10 year long supported behaviour).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fair enough !

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 5, 2022

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit bf917df

@DanielNoord DanielNoord merged commit 5b95e85 into pylint-dev:main Sep 5, 2022
@DanielNoord DanielNoord deleted the disable-next branch September 5, 2022 11:44
@Pierre-Sassoulas Pierre-Sassoulas added Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Sep 6, 2022
Pierre-Sassoulas pushed a commit to Pierre-Sassoulas/pylint that referenced this pull request Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

disable-next leaks into the whole block if it's followed by an empty line

3 participants