svnsonarqubepre-commit-hooksvn-hooks

Is it possible to stop svn commit if the code has sonar violations?


I want to add a pre-hook to SVN, basically it should stop if any new violations were introduced in the checked in java file. (we are using SonarQube for code quality)


Solution

  • Using a pre-commit hook, you can run a SonarQube analysis in preview mode (i.e. an analysis that does not push data to the server) and check if issues (and most importantly new issues) were found or not. If (new) issues are found, then you can prevent the commit.

    Please read the Getting Issues Report in Preview Mode documentation.