| Table of Contents |
Description / Features
This plugin enables the analysis of Python projects.
Dependencies
This plugin has the following dependencies:
- Pylint must be installed to check Pylint coding rules.
Installation
- Install the Python plugin through the Update Center
- Restart Sonar
Usage
You can analyze your project with the different analyzers. Here are properties files examples for the Sonar Runner and Maven.
A list of sample projects is available on github that can be browsed or downloaded:
- Python project analyzed with the Sonar Runner: /projects/languages/python/python-sonar-runner.
- Python project analyzed with Maven: /projects/languages/python/python-maven
Advanced settings to use pylint:
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. It has to be set on Windows, use either masked backslashes or slashes as path separators; examples: C:\\Python26\\Scripts\\pylint.bat or C:/Python/26/Scripts/pylint.bat | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sonar.python.pylint_config | Project-wide | .pylintrc | Path to the pylint configuration file (relative to project root or absolute) to use in pylint analysis. Set to empty to use the default. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description / FeaturesThis plugin enables the analysis of Python projects. DependenciesThis plugin has the following dependencies:
Installation
UsageYou can analyze your project with the different analyzers. Here are properties files examples for the Sonar Runner and Maven. A list of sample projects is available on github that can be browsed or downloaded:
Advanced settings to use pylint:
Make sure to set up the environment properly (PYTHONPATH etc.) before running the analyzer, if your project requires it. Extending Coding Rules using XPathNew coding rules can be added using XPath. See the related documentation. To navigate the AST, download the SSLR Python Toolkit. Changelog
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Make sure to set up the environment properly (PYTHONPATH etc.) before running the analyzer, if your project requires it.
Extending Coding Rules using XPath
New coding rules can be added using XPath. See the related documentation.
To navigate the AST, download the SSLR Python Toolkit.
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 |

