Code analysis with SonarQube in pre-commit.
- Git
- Python 3.6.1
- SonarQube
- Install Python 3.6.1;
- Clone this repository;
- Execute
python first_run.py
in cmd prompt; - Verify that the directory has been created:
C:\Sonar\
├ issues-report
├ sonar-scanner
└ template
└ template.sonarsource.properties
- Update the
config.ini
to add the settings of your sonarqube server, repository, systems and on/off scan; - 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"