SonarQube 1C (BSL) Community Plugin

Actions Status Download Quality Gate Maintainability Coverage telegram

1C:Enterprise and OneScript languages support for SonarQube.

Russian version


Install and Update

Version matrix

SonarQube Version Plugin Version JAVA version
9.9+ 1.13.0+ 17
8.9+ 1.11.0…1.12.0 11
7.9+ 0.7.0….1.10.0 11
7.4 - 7.8 0.1.0….0.6.0 8

Run analysis

Setting up the environment

The sonar-scanner utility is used for analyzing 1C:Enterprise source files.

You must specify the analysis parameters for the utility in one of the following ways:

An example of the file :

# The key of the project. Unique within the SonarQube server
# The project name displayed in the SonarQube interface. The default value is the project key.
sonar.projectName=My project
# The version of the project
# The path to the source code. Relative paths are resolved from the sonar-project
# A slash ("/") is used as a path separator. You can specify multiple directories separated by commas.
# Encoding of source files. 

# Filters for inclusion in the analysis. In the example below - only bsl and os files.
sonar.inclusions=**/*.bsl, **/*.os

Parameters passing ways may be combined.

If the SonarQube server has enabled the requirement of forced authorization and/or the prohibition of anonymous project analysis, you need to pass an authorization token the sonar-scanner utility, which can be obtained according to the instruction User guide/User token

For example

sonar-scanner -Dsonar.login=SONAR_AUTH_TOKEN

Plugin settings

Language switch for rule names/descriptions and issue messages

Plugin contains support of two languages for rule names/descriptions and issue messages:

You can switch language by changing the sonar.bsl.languageserver.diagnosticLanguage setting, located at “Administration” panel, category 1C (BSL).

To change language of names and descriptions of rules you should change this setting in server “Administration” panel:


Rule names

To change language of issue texts you should change this setting in project “Administration” panel:


Rule names

Integration with BSL Language Server

By default, the built-in diagnostics provider from BSL Language Server is used as the analyzer.

The built-in analyzer can be disabled by setting the sonar parameter.bsl.language server.enabled value false via command line or settings file.

sonar-scanner -Dsonar.bsl.languageserver.enabled=false

Disabling the analyzer does not disable the file parsing process. Metrics calculation and syntax highlighting will work regardless of the setting value.

Import results from external file

BSL Language Server can run source code analysis and output a list of detected diagnostics as a JSON file. Instructions for running BSL Language Server in analysis mode are available on the project page.

To import the result to sonar-scanner utility, pass the parameter sonar.bsl.languageserver.reportPaths via command-line arguments or via the file., which specifies the path to the file (or files, separated by commas) with the analysis results.

sonar-scanner -Dsonar.bsl.languageserver.reportPaths=./bsl-json.json

Calculate loc for cover (Deprecated)

Use Coverage41C as full coverage report generator.