- What version are you upgrading from? → 8.9.9 to 9.9.1
- System information (Operating system, Java version, Database provider/version) → OS Debian Slim Buster, Java 17.01 , Postgres 10
- What’s the issue you’re facing?
while running an analysis on our staging license before upgrading to the latest LTS, we faced the following issue in one of our ruby projects.
INFO: Importing XXX/report.json
ERROR: No issues information will be saved as the report file '/XXX/report.json' can't be read. 1 is not a valid line offset for pointer. File XXX.rb has 0 character(s) at line 32
java.lang.IllegalArgumentException: 1 is not a valid line offset for pointer. File XXX.rb has 0 character(s) at line 32
at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:356)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:289)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:305)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopSensor.saveIssue(RuboCopSensor.java:120)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopSensor.lambda$importReport$1(RuboCopSensor.java:86)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopJsonReportReader.onOffense(RuboCopJsonReportReader.java:96)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopJsonReportReader.lambda$onFile$0(RuboCopJsonReportReader.java:77)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopJsonReportReader.onFile(RuboCopJsonReportReader.java:77)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopJsonReportReader.read(RuboCopJsonReportReader.java:69)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopJsonReportReader.read(RuboCopJsonReportReader.java:62)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopSensor.importReport(RuboCopSensor.java:86)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopSensor.lambda$reportConsumer$0(RuboCopSensor.java:70)
at org.sonarsource.slang.plugin.AbstractPropertyHandlerSensor.lambda$executeOnFiles$1(AbstractPropertyHandlerSensor.java:84)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
at org.sonarsource.slang.plugin.AbstractPropertyHandlerSensor.executeOnFiles(AbstractPropertyHandlerSensor.java:82)
at org.sonarsource.slang.plugin.AbstractPropertyHandlerSensor.execute(AbstractPropertyHandlerSensor.java:74)
at org.sonarsource.ruby.externalreport.rubocop.RuboCopSensor.execute(RuboCopSensor.java:64)
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:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
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(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
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)
INFO: Sensor Import of RuboCop issues [ruby] (done) | time=937ms
We depend on using rubocop as a third-party issue report and need this for our reporting to the customers.
We figured out this is mostly raised by rules refering to an empty line or a block comment, so mainly Layout and Style catagory cops.
Up to now we could identifiy the following cops to fail for sure:
Style/BlockComments,Layout/EmptyLines,Layout/EmptyLinesAroundBeginBody,Layout/EmptyLinesAroundAccessModifier,Layout/EmptyLinesAroundArguments,Layout/EmptyLinesAroundAttributeAccessor,Layout/EmptyLinesAroundBlockBody,Layout/EmptyLinesAroundClassBody,Layout/EmptyLinesAroundExceptionHandlingKeywords,Layout/EmptyLinesAroundMethodBody,Layout/EmptyLinesAroundModuleBody,Style/FrozenStringLiteralComment