Repository navigation
Auto-unboxing issue in CheckstyleAuditListener #199
Copy link
Copy link
Closed
Description
Activity
Code is at
which does indeed return a class IntegerLine 106 in e167452
.at(currentResource.selectLine(getLineId(event))) Line 160 in e167452
static Integer getLineId(AuditEvent event) { I'm not sure why code would rather use
nullinstead of0. Seems odd.
Lines 164 to 166 in e167452
// checkstyle returns 0 if there is no relation to a file content, // but we use null if (line != 0) {
I guess this is because it has to select a line and was expecting to not select anything withnull. I would think this is the code we change to not returnnullbut instead default to1.This used to be the required behavior for checks that flag the entire file
So why wasn't this an issue in sonar before but it is now? Or was this always a problem and no one run checks that flagged line 0 to notice?
- added 6 commits that reference this issue
on Mar 21, 2019
Sonar version: 7.6
Checkstyle sonar plugin verson: 4.18
Steps to reproduce or description of problem:
Run any check which reports line 0 for an issue. This used to be the required behavior for checks that flag the entire file, and have no relation to the AST. For example FileSetChecks.
I know there was a breaking change in checkstyle/checkstyle#6000, changing the "magic" line number to 1. This kind of neutralizes this problem.
BUT: I noticed the problem running custom checks at work. I would expect some custom checks to be around that haven't noticed checkstyle/checkstyle#6000.
The error caused is this:
I have already fixed this, it's a small thing. PR upcoming.