Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SonarQube output format startColumn needs to be zero based #161

Closed
karlajw opened this issue Nov 16, 2021 · 4 comments
Closed

SonarQube output format startColumn needs to be zero based #161

karlajw opened this issue Nov 16, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@karlajw
Copy link

karlajw commented Nov 16, 2021

Thank you for creating the issue!

  • [x ] Yes, I've searched similar issues on GitHub and didn't find any.
  • [x ] Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke

0.15.0, 0.15.1, 0.16.1

Config file

default config

Go environment
$ go version && go env
# paste output here
Verbose output of running

Woke generated an issue report that has the same value of 'startColumn' and 'endColumn' (both with a value of 1) when there is only one column (ie. file name, java package name)

{
"issues":[
{
"engineId":"woke",
"ruleId":"dummy",
"primaryLocation":{
"message":"Filename finding: dummy may be insensitive, use placeholder, sample instead",
"filePath":"src/main/java/com/testco/pocproject/dummy",
"textRange":{
"startLine":1,
"startColumn":1,
"endColumn":1
}
},
"type":"CODE_SMELL",
"severity":"MAJOR"
},

......

]
}

SonarQube throws the following runtime error when trying to import the above issue format:

ERROR: Error during SonarScanner execution
java.lang.IllegalArgumentException: Start pointer [line=1, lineOffset=1] should be before end pointer [line=1, lineOffset=1]

SonarQube documentation shows the startColumn field as zero based https://docs.sonarqube.org/latest/analysis/generic-issue/

The Hadolint project has had a similar issue eg. hadolint/hadolint#658

@karlajw karlajw added the bug Something isn't working label Nov 16, 2021
cognitivegears added a commit to cognitivegears/woke that referenced this issue Nov 17, 2021
@cognitivegears
Copy link
Contributor

I've duplicated this issue with a local Sonarqube instance. This happens for file/path results where the start index and end index are both set to 1. Sonarqube doesn't like having these set to the same value and fails to import. Created a potential fix as #162 and added a test to expose / validate the issue resolution.

@karlajw
Copy link
Author

karlajw commented Nov 18, 2021

Thanks for the quick fix!

@caitlinelfring
Copy link
Member

caitlinelfring commented Nov 18, 2021

Released in v0.17.1

@caitlinelfring
Copy link
Member

Thanks for the quick fix @cognitivegears!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants