diff options
author | Konstantina Saketou <56515303+ksaketou@users.noreply.github.com> | 2021-03-25 22:01:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 21:01:53 +0100 |
commit | ea1fcd6a94403c1c17718c934903f0f57b51aba5 (patch) | |
tree | 98cf44f178f7abe5e5f9c2f4e92a8e27a725dee4 | |
parent | d274b660a7b7cc4b6910bf69a33dae0a7d5d9c53 (diff) | |
download | pylint-git-ea1fcd6a94403c1c17718c934903f0f57b51aba5.tar.gz |
Fix column index of FIXME warnings (#4246)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-rw-r--r-- | CONTRIBUTORS.txt | 2 | ||||
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | pylint/checkers/misc.py | 3 | ||||
-rw-r--r-- | tests/functional/f/fixme.txt | 16 | ||||
-rw-r--r-- | tests/functional/f/fixme_bad_formatting_1139.txt | 2 |
5 files changed, 16 insertions, 11 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 9932c5553..eb309acda 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -460,3 +460,5 @@ contributors: * Alexander Kapshuna: contributor * Mark Byrne: contributor + +* Konstantina Saketou: contributor @@ -67,6 +67,10 @@ Release date: TBA Closes #4215 +* Fix column index on FIXME warning messages + + Closes #4218 + What's New in Pylint 2.7.2? =========================== diff --git a/pylint/checkers/misc.py b/pylint/checkers/misc.py index 9b75fd43b..968cce241 100644 --- a/pylint/checkers/misc.py +++ b/pylint/checkers/misc.py @@ -173,10 +173,9 @@ class EncodingChecker(BaseChecker): # emit warnings if necessary match = self._fixme_pattern.search("#" + comment_text.lower()) if match: - note = match.group(1) self.add_message( "fixme", - col_offset=comment.string.lower().index(note.lower()), + col_offset=comment.start[1] + 1, args=comment_text, line=comment.start[0], ) diff --git a/tests/functional/f/fixme.txt b/tests/functional/f/fixme.txt index 43b6763b9..198e08a4b 100644 --- a/tests/functional/f/fixme.txt +++ b/tests/functional/f/fixme.txt @@ -1,9 +1,9 @@ -fixme:5:2::"FIXME: beep" -fixme:11:2::"FIXME: Valid test" -fixme:14:2::"TODO: Do something with the variables" -fixme:16:2::"XXX: Fix this later" -fixme:18:1::"FIXME: no space after hash" -fixme:20:1::"todo: no space after hash" +fixme:5:1::"FIXME: beep" +fixme:11:20::"FIXME: Valid test" +fixme:14:5::"TODO: Do something with the variables" +fixme:16:18::"XXX: Fix this later" +fixme:18:5::"FIXME: no space after hash" +fixme:20:5::"todo: no space after hash" fixme:23:2::"FIXME: this is broken" -fixme:25:2::"./TODO: find with notes" -fixme:27:2::"TO make something DO: find with regex" +fixme:25:5::"./TODO: find with notes" +fixme:27:5::"TO make something DO: find with regex" diff --git a/tests/functional/f/fixme_bad_formatting_1139.txt b/tests/functional/f/fixme_bad_formatting_1139.txt index 244778bec..4da0264f2 100644 --- a/tests/functional/f/fixme_bad_formatting_1139.txt +++ b/tests/functional/f/fixme_bad_formatting_1139.txt @@ -1 +1 @@ -fixme:6:2::TODO Lorem ipsum dolor sit amet consectetur adipiscing elit # [fixme] +fixme:6:1::TODO Lorem ipsum dolor sit amet consectetur adipiscing elit # [fixme] |