Error on first empty lines

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube LTS 9.9
    Sonar-scanner 4.8.1

  • what are you trying to achieve
    We use pylint to check Python code with cnes-pylint-extension and sonarjson to give the result to SonarQube.
    When the first line is empty. An error of the scanner is thrown

We already create an issue on the pylint plugin. But the explanation seems to be a problem with SonarQube : sonar-scanner import error when empty line · Issue #7 · omegacen/pylint-sonarjson · GitHub

  • what have you tried so far to achieve this

module :

Classe Database Interrogation

import ast

tree = ast.parse("print('à')")
for node in ast.walk(tree):
    print("children: " + str([x for x in ast.iter_child_nodes(node)]) + "\\n") :

# project metadata

# sources

# Pylint report path

The command to reproduce :

python -m venv .venv
source .venv/bin/activate
pip install pip --upgrade
pip install cnes-pylint-extension 
pip install pylint-sonarjson==1.0.5
pylint --rcfile=pylintrc_RNC2015_D --exit-zero --halt-on-invalid-sonar-rules n > pylint_report.json

Error :

INFO: Scanner configuration file: /opt/sonar-scanner/conf/
INFO: Project root configuration file: /builds/usinelogicielle/private/sandbox/sonar-scanner-error-when-empty-line-on/
INFO: SonarScanner
INFO: Java 11.0.20 Alpine (64-bit)
INFO: Linux 3.10.0-1160.95.1.el7.x86_64 amd64
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Analyzing on SonarQube server
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=192ms
INFO: Server id: <SERVER_ID>
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=58ms
INFO: Load/download plugins (done) | time=3608ms
INFO: Process project properties
INFO: Process project properties (done) | time=10ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: sonar-scanner-empty-line
INFO: Base dir: /builds/usinelogicielle/private/sandbox/sonar-scanner-error-when-empty-line-on
INFO: Working dir: /builds/usinelogicielle/private/sandbox/sonar-scanner-error-when-empty-line-on/.scannerwork
INFO: Load project settings for component key: 'sonar-scanner-empty-line'
INFO: Load project branches
INFO: Load project branches (done) | time=8ms
INFO: Load branch configuration
INFO: Load branch configuration (done) | time=3ms
INFO: Auto-configuring with CI 'Gitlab CI'
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=188ms
INFO: Load active rules
INFO: Load active rules (done) | time=1734ms
INFO: Load analysis cache
INFO: Load analysis cache (404) | time=8ms
INFO: Branch name: main
INFO: Load project repositories
INFO: Load project repositories (done) | time=19ms
INFO: Indexing files...
INFO: Project configuration:
INFO: 5 files indexed
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for json: Sonar way
INFO: Quality profile for py: Sonar way
INFO: ------------- Run sensors on module sonar-scanner-empty-line
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=28ms
INFO: Sensor Import external issues report
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 12.046s
INFO: Final Memory: 19M/67M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.IllegalArgumentException: Start pointer [line=1, lineOffset=0] should be before end pointer [line=1, lineOffset=0]
	at org.sonar.api.utils.Preconditions.checkArgument(
	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(
	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(
	at org.sonar.scanner.externalissue.ExternalIssueImporter.fillLocation(
	at org.sonar.scanner.externalissue.ExternalIssueImporter.importIssue(
	at org.sonar.scanner.externalissue.ExternalIssueImporter.execute(
	at org.sonar.scanner.externalissue.ExternalIssuesImportSensor.execute(
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(
	at org.sonar.core.platform.SpringComponentContainer.startComponents(
	at org.sonar.core.platform.SpringComponentContainer.execute(
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(
	at org.sonar.core.platform.SpringComponentContainer.startComponents(
	at org.sonar.core.platform.SpringComponentContainer.execute(
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(
	at org.sonar.core.platform.SpringComponentContainer.startComponents(
	at org.sonar.core.platform.SpringComponentContainer.execute(
	at org.sonar.batch.bootstrapper.Batch.doExecute(
	at org.sonar.batch.bootstrapper.Batch.execute(
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.base/java.lang.reflect.Method.invoke(
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(
	at org.sonarsource.scanner.cli.Main.execute(
	at org.sonarsource.scanner.cli.Main.execute(
	at org.sonarsource.scanner.cli.Main.main(

Did you reproduce? Can you develop a solution?

Hi there!

Thank you very much for bringing this to us!

I was able to reproduce it and it is a corner case we missed on our side.
I have created a bug ticket which should be tackled in 10.4.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.