Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current ·  View Page History

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

  1. Install the Python plugin through the Update Center
  2. Restart Sonar

Configuration

Property

Scope

Example

Description

sonar.python.pylintSystem-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_configProject-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.pathProject-wideengine,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.properties file at the root directory of your project
  • Set sonar.language to py. Syntax: sonar.language=py
  • Make sure that the Sonar server is running
  • Run sonar-runner in the directory containing the sonar-project.properties file

See here for general information about analyzing via sonar-runner.

Sample Project

... is available here.

Changelog

Version 1.0 (26 issues)
Type Key Summary Priority Status Resolution
Bug SONARPLUGINS-1721 pygenie stops the code analyse if it tries to analyse a file not ending with a empty row Critical Closed Fixed
New Feature SONARPLUGINS-2049 Rule: Avoid usage of print statement Major Closed Fixed
New Feature SONARPLUGINS-2041 Rule: Avoid too complex file Major Closed Fixed
New Feature SONARPLUGINS-2036 Rule: Avoid too complex class Major Closed Fixed
New Feature SONARPLUGINS-2035 Metric: classes Major Closed Fixed
New Feature SONARPLUGINS-2032 Rule: Always use upper case "L" for long integers Major Closed Fixed
New Feature SONARPLUGINS-2031 Rule: Regular expression on comment Major Closed Fixed
New Feature SONARPLUGINS-2028 Rule: Avoid too complex function Major Closed Fixed
New Feature SONARPLUGINS-2030 Rule: Avoid deeply nested if statements Major Closed Fixed
New Feature SONARPLUGINS-2024 Rule: Avoid usage of <> operator Major Closed Fixed
New Feature SONARPLUGINS-2025 Rule: Line too long Major Closed Fixed
New Feature SONARPLUGINS-2022 Rule: Avoid usage of exec statement Major Closed Fixed
New Feature SONARPLUGINS-2026 Rule: One statement per line Major Closed Fixed
New Feature SONARPLUGINS-2023 Rule: Avoid usage of `` (backtick) operator Major Closed Fixed
New Feature SONARPLUGINS-2021 Rule: When there is a parsing error, this error should be added like a violation on that Python file Major Closed Fixed
Improvement SONARPLUGINS-2020 Replace ANTLR-based lexer by our own Major Closed Fixed
Improvement SONARPLUGINS-2019 Rename default quality profile to "Sonar way" to be consistent with other plugins Major Closed Fixed
Bug SONARPLUGINS-2018 Python Plugin not compatible with SCM Activity Plugin Major Closed Fixed
New Feature SONARPLUGINS-2016 Metric: blank comments Major Closed Fixed
New Feature SONARPLUGINS-2013 Metric: statements Major Closed Fixed
New Feature SONARPLUGINS-2014 Rule: Generic Python rule to define some homemade checks with an XPath expression Major Closed Fixed
New Feature SONARPLUGINS-2012 Provide Python rule engine based on SSLR Major Closed Fixed
New Feature SONARPLUGINS-2015 Metric: functions Major Closed Fixed
New Feature SONARPLUGINS-1830 Implement Python parser based on SSLR Major Closed Fixed
New Feature SONARPLUGINS-2006 Provide a default SQALE mapping for the Python rules Major Closed Fixed
Bug SONARPLUGINS-1722 Absolut paths in sonar.python.pylint_config are prefixed with the path of the project Major Closed Fixed

 

Version 0.1 (5 issues)
Type Key Summary Priority Status Resolution
Improvement SONARPLUGINS-1547 Make the pylint integration configurable Major Closed Fixed
New Feature SONARPLUGINS-1639 Support of code duplication detection Major Closed Fixed
Improvement SONARPLUGINS-1635 Rework the recognition of basic program entities Major Closed Fixed
Improvement SONARPLUGINS-1634 Improve the pylint integration Major Closed Fixed
New Feature SONARPLUGINS-1573 Add a colorizer for python code Major Closed Fixed

 

Labels
  • None