-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
PyLint Comments Work With Other Linter Comments #2537
Changes from all commits
277a27c
6892c6e
1d67786
c06bcc8
8093191
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,3 +243,5 @@ contributors: | |
* Scott Worley: contributor | ||
|
||
* Michael Hudson-Doyle | ||
|
||
* Devyn Collier Johnson: Fixes bugs |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1260,8 +1260,13 @@ def check_line(line, i): | |
_msg_id.strip() for _msg_id in back_of_equal.split(",") | ||
}: | ||
return None | ||
line = line.rsplit("#", 1)[0].rstrip() | ||
|
||
# Find the Pylint comment among all other special comments on the line | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a better solution would be to use
|
||
_comments = line.rsplit(r'#') | ||
for _msg in _comments: | ||
_msg = _msg.strip() | ||
if _msg.startswith(r'pylint:') and r'disable' in _msg: | ||
line = _msg | ||
break | ||
if len(line) > max_chars and not ignore_long_line.search(line): | ||
self.add_message("line-too-long", line=i, args=(len(line), max_chars)) | ||
return i + 1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -814,7 +814,13 @@ def process_tokens(self, tokens): | |
match = utils.OPTION_RGX.search(content) | ||
if match is None: | ||
continue | ||
|
||
# Find the Pylint comment among all other special comments on the line | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't make sense, |
||
_comments = content.rsplit(r'#') | ||
for _msg in _comments: | ||
_msg = _msg.strip() | ||
if _msg.startswith(r'pylint:') and r'disable' in _msg: | ||
content = r'#' + _msg | ||
break | ||
first_group = match.group(1) | ||
if ( | ||
first_group.strip() == "disable-all" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ | |
# Allow stopping after the first semicolon/hash encountered, | ||
# so that an option can be continued with the reasons | ||
# why it is active or disabled. | ||
OPTION_RGX = re.compile(r"\s*#.*\bpylint:\s*([^;#]+)[;#]{0,1}") | ||
OPTION_RGX = re.compile(r'.*#\s*pylint:\s*([^;#]+)[;#]?.*') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think replacing |
||
|
||
# The line/node distinction does not apply to fatal errors and reports. | ||
_SCOPE_EXEMPT = "FR" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure your PR actually fixes all these bugs? From what I'm noticing:
# pylint: disable
comment #2297 is already fixed in masterUnless you are testing with a completely different code than the one posted in the aforementioned comment, I don't think your PR "fixes" these issues, as they are already fixed. What instead is fixing is that it correctly supports long lines and additional disables, but that's a separate bug.