Skip to content

Commit 8f25f13

Browse files
authored
Improve SpotBugs violation details (#4398)
1 parent 7edd84e commit 8f25f13

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/scripts/generate-quality-report.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,20 +259,24 @@ def parse_spotbugs() -> Tuple[Optional[AnalysisReport], bool, Optional[str]]:
259259
severity = "Low"
260260
severities[severity] += 1
261261
message = _clean_message(
262-
bug.findtext("ShortMessage")
262+
bug.attrib.get("message")
263263
or bug.findtext("LongMessage")
264-
or bug.attrib.get("message")
264+
or bug.findtext("ShortMessage")
265265
)
266266
bug_type = bug.attrib.get("type")
267267
source_line = bug.find(".//SourceLine[@primary='true']")
268268
if source_line is None:
269269
source_line = bug.find(".//SourceLine")
270270
if source_line is not None:
271271
source_path = source_line.attrib.get("sourcepath")
272-
line = source_line.attrib.get("start") or source_line.attrib.get("end")
272+
line = (
273+
bug.attrib.get("lineNumber")
274+
or source_line.attrib.get("start")
275+
or source_line.attrib.get("end")
276+
)
273277
else:
274278
source_path = None
275-
line = None
279+
line = bug.attrib.get("lineNumber")
276280
path_rel = _relative_path(source_path) if source_path else None
277281
if path_rel:
278282
location = path_rel

0 commit comments

Comments
 (0)