Created
March 13, 2018 10:07
-
-
Save MacRusher/a1778900ce72187c934bb4cfbd632723 to your computer and use it in GitHub Desktop.
Create backdated SonarQube analysis for a project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Prepare list of commit hashes. | |
# Adjust `since`, `grep` and other switches to your needs. | |
git log --merges --since=2018-02-01 --grep="(pull request #" --format="%H %ci" | | |
while read -a vars | |
do | |
# Checkout to given commit. | |
# Must be executed in the target repository, with no working three changes. | |
git checkout ${vars[0]} | |
# Performs analysis and publish it with the date of the commit. | |
# Assuming that sonar-project.properties is present and configured properly. | |
sonar-scanner -X -Dsonar.analysis.mode=publish -Dsonar.projectDate=${vars[1]} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment