Requires Sonar version
2.9 or higher
GNU LGPL v3
Description / Features
This plugin enables the analysis of Python projects.
Current feature list:
- Recognition of basic program entities:
- Python modules
- Python packages
- Provides basic size metrics:
- files (number of)
- lines of comments
- lines of code
- Static code checking via pylint (covering as well code style as code defects aspects)
- Provides cyclomatic complexity metrics including:
- Complexity per function/method
- Complexity per module
- Complexity distributions
- Basic highlighting mode for Python in Sonar UI
This plugin has following dependencies:
- For complexity analysis the Python interpreter is needed, anything >=2.5 will do.
- Pylint is used for the rules compliance analysis.
- Copy the jar-archive into /extensions/plugins/ directory
- Restart the Sonar web server
You can analyze your projects using the usual means (see this page for all available). Just make sure to set a couple of properties. See below how to do it for maven and sonar-runner.
Analyzing with maven
Add your source directories to the build and the language-property to the properties section of your pom (see below for syntax)
- Make sure the dynamic analysis not switched of
- Make sure sonar-server is running
Start the analysis with
See here for general information about analyzing via maven.
Analyzing with sonar-runner
- Add a
sonar-project.properties-file to the root directory of your project
pyand other fields according to the general description
- Make sure your sonar-server is running
sonar-runnerin the directory containing the
See here for general information about analyzing via sonar-runner.