Hello everyone, I am encountering an issue while running SonarScanner with ESLint integration on my project. The scan fails with the following error:
10:39:00.556 INFO: Rule | Time (ms) | Relative
10:39:00.556 INFO: :----|----------:|--------:
10:39:02.326 INFO: ------------------------------------------------------------------------
10:39:02.326 INFO: EXECUTION FAILURE
10:39:02.326 INFO: ------------------------------------------------------------------------
10:39:02.327 INFO: Total time: 1:18.454s
10:39:02.441 INFO: Final Memory: 19M/123M
10:39:02.442 INFO: ------------------------------------------------------------------------
10:39:02.442 ERROR: Error during SonarScanner execution
java.lang.IllegalArgumentException: -1 is not a valid line offset for a file
at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:372)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:307)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:322)
at org.sonar.plugins.javascript.external.EslintReportSensor.getLocation(EslintReportSensor.java:139)
at org.sonar.plugins.javascript.external.EslintReportSensor.saveEslintError(EslintReportSensor.java:97)
at org.sonar.plugins.javascript.external.EslintReportSensor.importReport(EslintReportSensor.java:76)
at org.sonar.plugins.javascript.external.AbstractExternalIssuesSensor.lambda$execute$1(AbstractExternalIssuesSensor.java:55)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.sonar.plugins.javascript.external.AbstractExternalIssuesSensor.execute(AbstractExternalIssuesSensor.java:55)
at org.sonar.plugins.javascript.external.EslintReportSensor.execute(EslintReportSensor.java:43)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:204)
at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:200)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:173)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:351)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:138)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
at org.sonarsource.scanner.cli.Main.main(Main.java:62)
10:39:02.444 ERROR:
10:39:02.444 ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
10:39:02.451 DEBUG: Cleanup org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda$302/0x00007ff96c287b50@7808fb9 during JVM shutdown
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit code 1
1mERROR: Job failed: exit code 1
Here is some example of ESLint reports I am using (source code section is hidden for brevity and privacy) that are causing the error :
[
{
"filePath": "/builds/sti/templates/angular/components/core/app-initializer/app-initializer.module.ts",
"messages": [],
"suppressedMessages": [],
"errorCount": 0,
"fatalErrorCount": 0,
"warningCount": 0,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"usedDeprecatedRules": []
},
{
"filePath": "/builds/sti/templates/angular/components/core/app-initializer/initialize-authentication-factory.ts",
"messages": [
{
"ruleId": "@typescript-eslint/no-empty-function",
"severity": 2,
"message": "Unexpected empty arrow function.",
"line": 11,
"column": 28,
"nodeType": "ArrowFunctionExpression",
"messageId": "unexpected",
"endLine": 11,
"endColumn": 30
}
],
"suppressedMessages": [],
"errorCount": 1,
"fatalErrorCount": 0,
"warningCount": 0,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"source": "...",
"usedDeprecatedRules": []
},
{
"filePath": "/builds/sti/templates/angular/components/core/app-initializer/initialize-config-factory.ts",
"messages": [
{
"ruleId": "@typescript-eslint/no-explicit-any",
"severity": 2,
"message": "Unexpected any. Specify a different type.",
"line": 8,
"column": 83,
"nodeType": "TSAnyKeyword",
"messageId": "unexpectedAny",
"endLine": 8,
"endColumn": 86,
"suggestions": [
{
"messageId": "suggestUnknown",
"fix": {
"range": [
438,
441
],
"text": "unknown"
},
"desc": "Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct."
},
{
"messageId": "suggestNever",
"fix": {
"range": [
438,
441
],
"text": "never"
},
"desc": "Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of."
}
]
},
{
"ruleId": "@typescript-eslint/no-empty-function",
"severity": 2,
"message": "Unexpected empty arrow function.",
"line": 15,
"column": 18,
"nodeType": "ArrowFunctionExpression",
"messageId": "unexpected",
"endLine": 15,
"endColumn": 20
},
{
"ruleId": "@typescript-eslint/no-explicit-any",
"severity": 2,
"message": "Unexpected any. Specify a different type.",
"line": 18,
"column": 84,
"nodeType": "TSAnyKeyword",
"messageId": "unexpectedAny",
"endLine": 18,
"endColumn": 87,
"suggestions": [
{
"messageId": "suggestUnknown",
"fix": {
"range": [
759,
762
],
"text": "unknown"
},
"desc": "Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct."
},
{
"messageId": "suggestNever",
"fix": {
"range": [
759,
762
],
"text": "never"
},
"desc": "Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of."
}
]
},
{
"ruleId": "@typescript-eslint/no-empty-function",
"severity": 2,
"message": "Unexpected empty arrow function.",
"line": 34,
"column": 18,
"nodeType": "ArrowFunctionExpression",
"messageId": "unexpected",
"endLine": 34,
"endColumn": 20
}
],
"suppressedMessages": [],
"errorCount": 4,
"fatalErrorCount": 0,
"warningCount": 0,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"source": "...",
"usedDeprecatedRules": []
},
{
"filePath": "/builds/sti/templates/angular/components/core/app-initializer/initialize-domains-factory.ts",
"messages": [
{
"ruleId": "@typescript-eslint/no-explicit-any",
"severity": 2,
"message": "Unexpected any. Specify a different type.",
"line": 7,
"column": 81,
"nodeType": "TSAnyKeyword",
"messageId": "unexpectedAny",
"endLine": 7,
"endColumn": 84,
"suggestions": [
{
"messageId": "suggestUnknown",
"fix": {
"range": [
316,
319
],
"text": "unknown"
},
"desc": "Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct."
},
{
"messageId": "suggestNever",
"fix": {
"range": [
316,
319
],
"text": "never"
},
"desc": "Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of."
}
]
},
{
"ruleId": "@typescript-eslint/no-empty-function",
"severity": 2,
"message": "Unexpected empty arrow function.",
"line": 22,
"column": 18,
"nodeType": "ArrowFunctionExpression",
"messageId": "unexpected",
"endLine": 22,
"endColumn": 20
}
],
"suppressedMessages": [],
"errorCount": 2,
"fatalErrorCount": 0,
"warningCount": 0,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"source": "...",
"usedDeprecatedRules": []
},
{
"filePath": "/builds/sti/templates/angular/components/core/app-initializer/initialize-permission-factory.ts",
"messages": [
{
"ruleId": "@typescript-eslint/no-explicit-any",
"severity": 2,
"message": "Unexpected any. Specify a different type.",
"line": 9,
"column": 84,
"nodeType": "TSAnyKeyword",
"messageId": "unexpectedAny",
"endLine": 9,
"endColumn": 87,
"suggestions": [
{
"messageId": "suggestUnknown",
"fix": {
"range": [
557,
560
],
"text": "unknown"
},
"desc": "Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct."
},
{
"messageId": "suggestNever",
"fix": {
"range": [
557,
560
],
"text": "never"
},
"desc": "Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of."
}
]
}
],
"suppressedMessages": [],
"errorCount": 1,
"fatalErrorCount": 0,
"warningCount": 0,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"source": "...",
"usedDeprecatedRules": []
},
{
"filePath": "/builds/sti/templates/angular/components/core/app-initializer/initialize-static-resources-factory.ts",
"messages": [],
"suppressedMessages": [],
"errorCount": 0,
"fatalErrorCount": 0,
"warningCount": 0,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"usedDeprecatedRules": []
},
{
"filePath": "/builds/sti/templates/angular/components/core/app-initializer/public-api.ts",
"messages": [],
"suppressedMessages": [],
"errorCount": 0,
"fatalErrorCount": 0,
"warningCount": 0,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"usedDeprecatedRules": []
},
{
"filePath": "/builds/sti/templates/angular/components/core/config/configuration.service.ts",
"messages": [
{
"ruleId": "eslint-comments/no-use",
"severity": 1,
"message": "Unexpected ESLint directive comment.",
"line": 11,
"column": 0,
"nodeType": null,
"endLine": 11,
"endColumn": 56
}
],
"suppressedMessages": [
{
"ruleId": "@typescript-eslint/no-explicit-any",
"severity": 2,
"message": "Unexpected any. Specify a different type.",
"line": 127,
"column": 73,
"nodeType": "TSAnyKeyword",
"messageId": "unexpectedAny",
"endLine": 127,
"endColumn": 76,
"suggestions": [
{
"messageId": "suggestUnknown",
"fix": {
"range": [
4628,
4631
],
"text": "unknown"
},
"desc": "Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct."
},
{
"messageId": "suggestNever",
"fix": {
"range": [
4628,
4631
],
"text": "never"
},
"desc": "Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of."
}
],
"suppressions": [
{
"kind": "directive",
"justification": ""
}
]
},
{
"ruleId": "@typescript-eslint/no-explicit-any",
"severity": 2,
"message": "Unexpected any. Specify a different type.",
"line": 140,
"column": 76,
"nodeType": "TSAnyKeyword",
"messageId": "unexpectedAny",
"endLine": 140,
"endColumn": 79,
"suggestions": [
{
"messageId": "suggestUnknown",
"fix": {
"range": [
5117,
5120
],
"text": "unknown"
},
"desc": "Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct."
},
{
"messageId": "suggestNever",
"fix": {
"range": [
5117,
5120
],
"text": "never"
},
"desc": "Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of."
}
],
"suppressions": [
{
"kind": "directive",
"justification": ""
}
]
},
{
"ruleId": "@typescript-eslint/no-explicit-any",
"severity": 2,
"message": "Unexpected any. Specify a different type.",
"line": 169,
"column": 79,
"nodeType": "TSAnyKeyword",
"messageId": "unexpectedAny",
"endLine": 169,
"endColumn": 82,
"suggestions": [
{
"messageId": "suggestUnknown",
"fix": {
"range": [
6031,
6034
],
"text": "unknown"
},
"desc": "Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct."
},
{
"messageId": "suggestNever",
"fix": {
"range": [
6031,
6034
],
"text": "never"
},
"desc": "Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of."
}
],
"suppressions": [
{
"kind": "directive",
"justification": ""
}
]
},
{
"ruleId": "@typescript-eslint/no-explicit-any",
"severity": 2,
"message": "Unexpected any. Specify a different type.",
"line": 182,
"column": 82,
"nodeType": "TSAnyKeyword",
"messageId": "unexpectedAny",
"endLine": 182,
"endColumn": 85,
"suggestions": [
{
"messageId": "suggestUnknown",
"fix": {
"range": [
6530,
6533
],
"text": "unknown"
},
"desc": "Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct."
},
{
"messageId": "suggestNever",
"fix": {
"range": [
6530,
6533
],
"text": "never"
},
"desc": "Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of."
}
],
"suppressions": [
{
"kind": "directive",
"justification": ""
}
]
}
],
"errorCount": 0,
"fatalErrorCount": 0,
"warningCount": 1,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"source": "...",
"usedDeprecatedRules": []
},
{
"filePath": "/builds/sti/templates/angular/components/core/icons/icons.module.ts",
"messages": [],
"suppressedMessages": [],
"errorCount": 0,
"fatalErrorCount": 0,
"warningCount": 0,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"usedDeprecatedRules": []
}
]
[
{
"filePath": "/builds/sti/templates/angular/components/types/geography.types.ts",
"messages": [
{
"ruleId": "eslint-comments/no-use",
"severity": 1,
"message": "Unexpected ESLint directive comment.",
"line": 1,
"column": 0,
"nodeType": null,
"endLine": 1,
"endColumn": 21
},
{
"ruleId": "eslint-comments/no-unlimited-disable",
"severity": 1,
"message": "Unexpected unlimited 'eslint-disable' comment. Specify some rule names to disable.",
"line": 1,
"column": 0,
"nodeType": null,
"endLine": 1,
"endColumn": 21
}
],
"suppressedMessages": [
{
"ruleId": "@typescript-eslint/ban-tslint-comment",
"severity": 2,
"message": "tslint comment detected: \"/* tslint:disable */\"",
"line": 2,
"column": 1,
"nodeType": "Block",
"messageId": "commentDetected",
"endLine": 2,
"endColumn": 21,
"fix": {
"range": [
21,
42
],
"text": ""
},
"suppressions": [
{
"kind": "directive",
"justification": ""
}
]
},
{
"ruleId": "@typescript-eslint/no-empty-interface",
"severity": 2,
"message": "An interface declaring no members is equivalent to its supertype.",
"line": 48,
"column": 18,
"nodeType": "Identifier",
"messageId": "noEmptyWithSuper",
"endLine": 48,
"endColumn": 30,
"fix": {
"range": [
1113,
1156
],
"text": "type GUIDirection = Direction"
},
"suppressions": [
{
"kind": "directive",
"justification": ""
}
]
},
{
"ruleId": "@typescript-eslint/no-empty-interface",
"severity": 2,
"message": "An interface declaring no members is equivalent to its supertype.",
"line": 50,
"column": 18,
"nodeType": "Identifier",
"messageId": "noEmptyWithSuper",
"endLine": 50,
"endColumn": 28,
"fix": {
"range": [
1165,
1204
],
"text": "type GUISection = Section"
},
"suppressions": [
{
"kind": "directive",
"justification": ""
}
]
},
{
"ruleId": "@typescript-eslint/no-empty-interface",
"severity": 2,
"message": "An interface declaring no members is equivalent to its supertype.",
"line": 52,
"column": 18,
"nodeType": "Identifier",
"messageId": "noEmptyWithSuper",
"endLine": 52,
"endColumn": 25,
"fix": {
"range": [
1213,
1246
],
"text": "type GUILane = Lane"
},
"suppressions": [
{
"kind": "directive",
"justification": ""
}
]
},
{
"ruleId": "@typescript-eslint/no-empty-interface",
"severity": 2,
"message": "An interface declaring no members is equivalent to its supertype.",
"line": 64,
"column": 18,
"nodeType": "Identifier",
"messageId": "noEmptyWithSuper",
"endLine": 64,
"endColumn": 31,
"fix": {
"range": [
1426,
1470
],
"text": "type RoadComponent = GeoObject"
},
"suppressions": [
{
"kind": "directive",
"justification": ""
}
]
}
],
"errorCount": 0,
"fatalErrorCount": 0,
"warningCount": 2,
"fixableErrorCount": 0,
"fixableWarningCount": 0,
"source": "...",
"usedDeprecatedRules": []
}
]
Steps I have taken:
- Checked ESLint Reports: The ESLint reports generated seem to have valid line and column numbers.
- Validated ESLint Output: Ran ESLint manually and the output did not show any anomalies.
- Reviewed Integration Configurations: Verified the SonarQube project configurations for ESLint integration.
- Debug Logging: Re-ran the SonarScanner with the
-X
switch but could not pinpoint the exact issue.
Additional Details:
- SonarQube Version: 10.5.1
- SonarQube Scanner Version: sonar-scanner-cli:5.0
- ESLint Version: 8.56.0
- GitLab version: 16.11.0
I would greatly appreciate any insights or suggestions on how to resolve this issue. Has anyone encountered a similar problem or can anyone point me in the right direction?
Thank you in advance for your help!