SonarQube 1C (BSL) Community Plugin
1C:Enterprise and OneScript languages support for SonarQube.
- Project “Overview” dashboard;
- Highlighting the source code of 1C: Enterprise;
- Calculation of basic metrics, calculation of the number of lines of code;
- Registration of diagnostics provided by BSL Language Server as internal rules;
- Embedded Analyzer - BSL Language Server Diagnostic provider
- Import results from external analyzers in internal json format;
Install and Update
- Download jar file from releases page
- Put the jar file according to Manual Installation section of official documentation (default -
- Restart server
|SonarQube Version||Plugin Version|
|7.4 - 7.8||0.1.0…0.6.0|
|Plugin Version||JAVA Version|
|0.1.0 - 0.6.0||8|
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:
- as command line arguments using the syntax
- using the file
An example of the
sonar-project.properties file :
# The key of the project. Unique within the SonarQube server sonar.projectKey=my_project # The project name displayed in the SonarQube interface. The default value is the project key. sonar.projectName=My project # The version of the project sonar.projectVersion=1.0 # The path to the source code. Relative paths are resolved from the sonar-project file.properties # A slash ("/") is used as a path separator. You can specify multiple directories separated by commas. sonar.sources=src # Encoding of source files. sonar.sourceEncoding=UTF-8 # 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
sonar-scanner -Dsonar.host.url=http://sonar.company.com -Dsonar.login=SONAR_AUTH_TOKEN
sonar.bsl.languageserver.diagnosticLanguage- the language of the rule names and message text of the triggered rules from the BSL Language Server. Default -
sonar.bsl.languageserver.enabled- use the built-in BSL Language Server Diagnostic provider analyzer when running analysis via
sonar-scanner. Default -
sonar.bsl.languageserver.reportPaths- the path to the report files in the internal format to the BSL Language Server -
json. By default -
""- not filled.
sonar.bsl.languageserver.skipSupport- skip computing diagnostics according to module’s support mode. Only if there is a parent configuration. Available values:
- with support locked - modules for support with the prohibition of changes will be skipped (“locked”);
- with support - modules on support will be skipped;
- never default - modules are not skipped
sonar.bsl.languageserver.overrideConfiguration- override Quality Profile settings with settings from BSL Language Server configuration file;
sonar.bsl.languageserver.configurationPath- path to BSL Language Server configuration file to override settings;
sonar.bsl.file.suffixes- list of file suffixes that will be scanned. Default -
sonar.bsl.calculateLineCover- calculate locations for coverage.
Language switch for rule names/descriptions and issue messages
Plugin contains support of two languages for rule names/descriptions and issue messages:
- russian (default);
You can switch language by changing the
sonar.bsl.languageserver.diagnosticLanguage setting, located at “Administration” panel, category
To change language of names and descriptions of rules you should change this setting in server “Administration” panel:
To change language of issue texts you should change this setting in project “Administration” panel:
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.
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
sonar-project.properties file., which specifies the path to the file (or files, separated by commas) with the analysis results.
Calculate loc for cover
Calculate locations for coverage. Use for correct code coverage when using genericCoverage.xml which contains only covered lines.
<coverage version="1"> <file path="...\Forms\Form\Ext\Form\Module.bsl"> <lineToCover lineNumber="25" covered="true"/> <lineToCover lineNumber="27" covered="true"/> </file> </coverage>