feat: support noqa before multiline strings#318
Draft
tacerus wants to merge 1 commit intowarpnet:mainfrom
Draft
Conversation
Allow rules applying to lines inside multiline strings inside lists to be skipped by using the "noqa" statement in the line of the multiline start marker. Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Author
|
See #317. |
roaldnefs
requested changes
Apr 27, 2026
Member
roaldnefs
left a comment
There was a problem hiding this comment.
As-written the patch silently breaks all existing noqa usage. Easy fixes; should not be marked ready until both bugs are fixed and a TestSkipRule case mirroring issue #317 is added.
Two blocking bugs:
- Operator precedence — > in any line propagates skips:
if last['line'].startswith('-') and '|' in last['line'] or '>' in last['line']parses as(startswith AND '|') OR '>'. So a Jinja line like{{ x > 5 }}after a list-item-with-noqa inherits the skip. Fix by parenthesizing the or. - Current-line noqa is now ignored:
skipsis built only fromlast['skips']; the final checkif self.id in skipsno longer consultsrule_id_list. Every existingkey: value # noqa: 204on a non-multiline line stops working. Fix by building a combined list that includesrule_id_list.
Other notes:
- No tests.
tests/unit/TestSkipRule.pyis the obvious place; tests would have caught both bugs immediately. not previous_skip in rule_id_list→previous_skip not in rule_id_list(pylint C0117).- Stray blank line at L84
- No
CHANGELOG.mdentry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow rules applying to lines inside multiline strings inside lists to be skipped by using the "noqa" statement in the line of the multiline start marker.