| Table of Contents |
Description / Features
This plugin enables the analysis of Python projects.
Dependencies
This plugin has following dependencies:
- Pylint is used for the rules compliance analysis.
Installation
- Install the Python plugin through the Update Center
- Restart Sonar
Configuration
Property | Scope | Example | Description |
|---|---|---|---|
| sonar.python.pylint | System-wide | /usr/local/bin/pylint | Path to the pylint executable to use in pylint analysis. Set to empty to use the default one. |
| sonar.python.pylint_config | Project-wide | .pylintrc | Path to the pylint configuration file (relative to project root) to use in pylint analysis. Set to empty to use the default. |
| sonar.python.path | Project-wide | engine,utils | Comma separated list of paths relative to project root to add to PYTHONPATH when executing pylint. |
Usage
Analyzing with Maven
Add your source directories to the build and the language-property to the properties section of your pom. Syntax:
<properties> ... <sonar.language>py</sonar.language> ... </properties> <build> ... <sourceDirectory> path </sourceDirectdory> ... </build>
Make sure the dynamic analysis is not switched off. Syntax:
<properties> ... <sonar.dynamicAnalysis>true<sonar.dynamicAnalysis> ... </properties>
- Make sure that the Sonar server is running
Start the analysis with
"mvn sonar:sonar"
See here for general information about analyzing via maven.
Analyzing with the Sonar Runner
- Add a
sonar-project.propertiesfile at the root directory of your project - Set
sonar.languagetopy.Syntax: sonar.language=py - Make sure that the Sonar server is running
- Run
sonar-runnerin the directory containing thesonar-project.propertiesfile
See here for general information about analyzing via sonar-runner.
Sample Project
... is available here.
Changelog
| Version 0.1 (5 issues) | |||||
|---|---|---|---|---|---|
| Type | Key | Summary | Priority | Status | Resolution |
|
|
SONARPLUGINS-1547 | Make the pylint integration configurable |
|
|
Fixed |
|
|
SONARPLUGINS-1639 | Support of code duplication detection |
|
|
Fixed |
|
|
SONARPLUGINS-1635 | Rework the recognition of basic program entities |
|
|
Fixed |
|
|
SONARPLUGINS-1634 | Improve the pylint integration |
|
|
Fixed |
|
|
SONARPLUGINS-1573 | Add a colorizer for python code |
|
|
Fixed |

