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 doesn't like "startLine": 0 #1

Open
umpaduncdude opened this issue Nov 21, 2023 · 0 comments
Open

SonarQube doesn't like "startLine": 0 #1

umpaduncdude opened this issue Nov 21, 2023 · 0 comments

Comments

@umpaduncdude
Copy link

When transforming fortify results using the co, one of the transformed results looked like this:

{
      "effortMinutes": 0,
      "engineId": "fortify",
      "primaryLocation": {
        "filePath": "<redacted>.yaml",
        "message": "Kubernetes Bad Practices: Default Namespace",
        "textRange": {
          "startLine": 0
        }
      },
      "ruleId": "4B70DD6DE913DF24E377AD6ACC22AD4D",
      "severity": "INFO",
      "type": "VULNERABILITY"
},

However, the Linux SonarScanner (sonar-scanner-cli-5.0.1.3006-linux) threw an error that looked like this:

#23 32.10 ERROR: Error during SonarScanner execution
#23 32.10 java.lang.IllegalArgumentException: 0 is not a valid line for a file
#23 32.10 	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
#23 32.10 	at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:370)
#23 32.10 	at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:307)
#23 32.10 	at org.sonar.api.batch.fs.internal.DefaultInputFile.selectLine(DefaultInputFile.java:330)
#23 32.10 	at org.sonar.scanner.externalissue.ExternalIssueImporter.fillLocation(ExternalIssueImporter.java:135)
#23 32.10 	at org.sonar.scanner.externalissue.ExternalIssueImporter.importIssue(ExternalIssueImporter.java:81)
#23 32.10 	at org.sonar.scanner.externalissue.ExternalIssueImporter.execute(ExternalIssueImporter.java:57)
#23 32.10 	at org.sonar.scanner.externalissue.ExternalIssuesImportSensor.execute(ExternalIssuesImportSensor.java:74)

On a hunch, I made a sed command to change "startLine": 0 to "startLine": 1, and the import worked.
It appears that SonarScanner does not like a file line of 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant