Skip to content

mkam/puppet-python-sonar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SonarQube with Python and Flake8

SonarQube is an open source quality management platform for analyzing and managing quality metrics, such as test coverage, code complexity, standards/rule violations. This module uses a modified Python plugin which adds Flake8 rules to the default set of Pylint rules.

Includes

Pre-requisites

If you want to run pylint or flake8 rules, make sure that they are installed on the server where static analysis is executing (e.g. Jenkins). Example:

pip install pylint
pip install flake8

Installing Module Dependencies

The puppet module dependencies can be installed using librarian-puppet with the Puppetfile, or manually with the following commands:

puppet module install maestrodev-sonarqube
puppet module install puppetlabs-java
puppet module install puppetlabs-postgresql
puppet module install stankevich-python

Installing This Module

git clone https://github.com/rackerlabs/puppet-python-sonar.git
mkdir -p /usr/share/puppet/modules
cp -r puppet-python-sonar/python_sonar /usr/share/puppet/modules
puppet apply puppet-python-sonar/default.pp

Using Sonar with Jenkins

  • Install the SonarQube plugin on Jenkins
  • Follow these steps to configure your Jenkins project. The database username and password are set in init.pp and both default to "sonar." When adding a Sonar Runner, use the "Install automatically" option.

Other Configuration Values:

Database URL: jdbc:postgresql://<sonar-uri>/sonar
Database driver: org.postgresql.Driver
  • Follow these steps to configure a project to run Sonar analysis. Include the following in the project properties.
# required metadata
sonar.projectKey=<project:key>
sonar.projectName=<name>
sonar.projectVersion=<version>

# path to source directories (required)
sonar.sources=<source directory>

# path to test source directories (optional)
# sonar.tests=testDir1,testDir2

# path to project binaries (optional), for example directory of Java bytecode
# sonar.binaries=binDir

# Uncomment this line to analyse a project which is not a java project.
# The value of the property must be the key of the language.
sonar.language=py
sonar.sourceEncoding=UTF-8
sonar.python.coverage.reportPath=coverage.xml

# Flake8 Configuration
sonar.python.flake8_config=tox.ini

About

Puppet module for SonarQube with Python and Flake8

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors