Closed ktraister closed 6 years ago
I can upload the contents of the script if needed, but I was hoping to find something pointing to a line with the character causing this headache
Thank you for raising this :) I found a bug and will fix it soon with the next version.
You rock! Thanks!
the 0.3.1 version fixed 90% of the errors I was seeing, but the following similar error is cropping up:
17:49:57.171 WARN: Exception while adding highlighting for: Token [text=# Mock -CommandName Invoke-Exe -MockWith { "★ Install of core/hab-sup/0.61.0/20180815130031 complete with 0 new packages installed." } -ModuleName PSHabitat, value=, tokenFlags=ParseModeInvariant, kind=Comment, startLineNumber=13, cType=Token, endLineNumber=13, startOffset=673, endOffset=833, startColumnNumber=3, endColumnNumber=163]
java.lang.IllegalArgumentException: Unable to highlight file Tests/Sync-HabPkgOnBldr.Tests.ps1
at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:97)
at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:37)
at org.sonar.plugins.powershell.fillers.HighlightingFiller.highlightToken(HighlightingFiller.java:40)
at org.sonar.plugins.powershell.fillers.HighlightingFiller.fill(HighlightingFiller.java:24)
at org.sonar.plugins.powershell.sensors.TokenizerSensor.execute(TokenizerSensor.java:113)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:302)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:297)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:271)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalArgumentException: 162 is not a valid line offset for pointer. File Tests/Sync-HabPkgOnBldr.Tests.ps1 has 161 character(s) at line 13
at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:312)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:246)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:262)
at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:95)
... 36 common frames omitted
Hi, I have update 0.3.1 version again. Could you re-download that and try again? Apart from that maybe those files are of different encoding than SonarQube expects?
Pre-release 0.3.1 downloaded from https://github.com/gretard/sonar-ps-plugin/releases solved the error. Looks like the remaining stack trace is caused by encoding errors on our side. This can be closed, you rock!
Powershell 5.1 Windows 10 Host
When calling the plugin as part of a Jenkins pipeline, we're experiencing this exception in some of our test scripts: