summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantina Saketou <56515303+ksaketou@users.noreply.github.com>2021-03-25 22:01:53 +0200
committerGitHub <noreply@github.com>2021-03-25 21:01:53 +0100
commitea1fcd6a94403c1c17718c934903f0f57b51aba5 (patch)
tree98cf44f178f7abe5e5f9c2f4e92a8e27a725dee4
parentd274b660a7b7cc4b6910bf69a33dae0a7d5d9c53 (diff)
downloadpylint-git-ea1fcd6a94403c1c17718c934903f0f57b51aba5.tar.gz
Fix column index of FIXME warnings (#4246)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-rw-r--r--CONTRIBUTORS.txt2
-rw-r--r--ChangeLog4
-rw-r--r--pylint/checkers/misc.py3
-rw-r--r--tests/functional/f/fixme.txt16
-rw-r--r--tests/functional/f/fixme_bad_formatting_1139.txt2
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
diff --git a/ChangeLog b/ChangeLog
index 8d73d6ebc..e9612696f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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]