/SonarCommitAnalyzer

Code analysis with SonarQube before commit.

Primary LanguagePythonMIT LicenseMIT

SonarCommitAnalyzer logo

Code analysis with SonarQube in pre-commit.

Pre requirements

  • Git
  • Python 3.6.1
  • SonarQube

Python libraries

Setting up

  1. Install Python 3.6.1;
  2. Clone this repository;
  3. Execute python first_run.py in cmd prompt;
  4. Verify that the directory has been created:
C:\Sonar\
├ issues-report
├ sonar-scanner
└ template
    └ template.sonarsource.properties
  1. Update the config.ini to add the settings of your sonarqube server, repository, systems and on/off scan;
  2. Update or create pre-commit file in the git hook folder of the repository {your_repository}\.git\hooks\pre-commit. The file should contain the following content:
#!/bin/sh
python "{replace}\SonarCommitAnalyzer\main.py"