Closed sergiocaserowl closed 1 month ago
Hi @sergiocaserowl,
Clearly there is no 55 lines in this file. This log line tells me the issue might be related to Periphery.
at fr.insideapp.sonarqube.swift.issues.periphery.PeripherySensor.execute(PeripherySensor.java:79)
Can you check the Periphery version used?
Can you run Periphery and see if it also output an issue at line 55 for that file ViewModifiers
?
@gaelfoppolo If I run periphery as "standalone" there is no crash, it just report the issues, is there any way to override the command that plugin executes? I would like to have just periphery scan
without parameters to check when sonar-scanner is executed
There is no crash because it just output the issues. Can you provide the Periphery report?
You can re-run SonarScanner in full debug logging using the -X flag. This will display the Periphery command and arguments the plugin executes. You can then executed that command and check the report.
As I see in the verbose logs, the sonar-scanner is executing: periphery scan --skip-build --format json --quiet
, if execute the script manually, it works as expected
Please provide the Periphery report, or at least the part related to the faulty file.
Sure @gaelfoppolo
11:38:02.478 INFO: Sensor Periphery Sensor [sonarapple]
11:38:02.478 DEBUG: Command that will be executed: periphery scan --skip-build --format json --quiet
11:38:11.551 INFO: Parsed 361 Periphery issue(s)
11:38:12.039 INFO: ------------------------------------------------------------------------
11:38:12.039 INFO: EXECUTION FAILURE
11:38:12.039 INFO: ------------------------------------------------------------------------
11:38:12.040 INFO: Total time: 1:12.067s
11:38:12.351 INFO: Final Memory: 696M/1694M
11:38:12.351 INFO: ------------------------------------------------------------------------
11:38:12.351 ERROR: Error during SonarScanner execution
java.lang.IllegalArgumentException: 55 is not a valid line for pointer. File iosApp/******/utils/ViewModifiers.swift has 38 line(s)
at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:371)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:307)
at org.sonar.api.batch.fs.internal.DefaultInputFile.selectLine(DefaultInputFile.java:330)
at fr.insideapp.sonarqube.apple.commons.issues.ReportIssueRecorder.recordIssues(ReportIssueRecorder.java:78)
at fr.insideapp.sonarqube.swift.issues.periphery.PeripherySensor.execute(PeripherySensor.java:79)
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:144)
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:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
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)
11:38:12.354 DEBUG: Cleanup org.eclipse.jgit.util.FS$FileStoreAttributes$$Lambda$388/0x000000012f384158@4047d2d9 during JVM shutdown
This is the SonarScanner logs.
The Periphery report is the logs from the periphery scan..
command.
Ah sorry, the output is just the just with information about the report, I can't leak that here... but it is just the json
I don't see what information it would be leaking, you have already provided the code of the file.
Please provide the JSON part of output of periphery scan --skip-build --format json --quiet
related to the ViewModifiers.swift
file. You can hide the sensitive content of the report, if needed.
I want to check if the value 55 is provided by Periphery or not. This information is in the Periphery report. Without this input, I will not be able to provide help.
@gaelfoppolo
{
"ids": [
"s:7SwiftUI4ViewP11E20navigationAppearance15backgroundColor010foregroundJ004tintJ013hideSeparatorQrSo7UIColorC_A2KSgSbtF"
],
"location": "*****/utils/ViewModifiers.swift:23:10",
"hints": [
"unused"
],
"modules": [
"******"
],
"name": "navigationAppearance(backgroundColor:foregroundColor:tintColor:hideSeparator:)",
"modifiers": [],
"attributes": [],
"kind": "function.method.instance",
"accessibility": "internal"
}
{
"modifiers": [],
"attributes": [],
"accessibility": "internal",
"ids": [
"s:1118NavigationColorBarV"
],
"name": "NavigationColorBar",
"hints": [
"unused"
],
"location": "*****/utils/ViewModifiers.swift:55:8",
"modules": [
"******"
],
"kind": "struct"
}
As you can see, on the second log, Periphery is detecting an issue on file ViewModifiers on line 55 column 8. So the issue is from Periphery, not the Sonar plugin, so I suggest you open one on their GitHub repository. I will close this.
New Issue Checklist
Issue Description
Getting this crash after execute sonar-scanner
Command executed
sonar-scanner
Complete output when running sonar-scanner, including the stack trace and command used
Environment
The content of the file: