Skip to content

Commit 66c4ef0

Browse files
Merge pull request #3 from aglensmith/fix-sonar-scanner-import-error-when-empty-line
fix sonar-scanner import error when empty line
2 parents e0ecd4e + ed557cf commit 66c4ef0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="pylint-sonarjson",
8-
version="2.0.0",
8+
version="2.0.1",
99
author="Teake Nutma, Topin2001",
1010
description="A PyLint plugin that can output to SonarQube-importable JSON",
1111
long_description=long_description,

src/pylint_sonarjson/sonarjson_reporter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ def _msg_to_sonar_dict(self, msg: Message):
4242
"message": msg.msg or "",
4343
"filePath": msg.path,
4444
"textRange": {
45-
"startLine": msg.line,
46-
"startColumn": msg.column,
45+
"startLine": msg.line
4746
}
4847
},
4948
"severity": self.sonar_checker.severity(msg),
5049
"effortMinutes": self.sonar_checker.effort(msg)
5150
}
51+
if hasattr(msg, "column") and msg.column > 0:
52+
sonar_dict["primaryLocation"]["textRange"]["startColumn"] = msg.column
5253
if hasattr(msg, "end_line") and msg.end_line:
5354
sonar_dict["primaryLocation"]["textRange"]["endLine"] = msg.end_line
5455
if hasattr(msg, "end_column") and msg.end_column:

0 commit comments

Comments
 (0)