6949

Automatically associate new Sonar project with custom quality profile and quality gate

Our use case for Sonar creates new Sonar projects for each branch of our repository. How do we automatically associate the new branch project with a (non-default) Quality Profile and Quality Gate?

We're running this in a Maven project if that's relevant.

Answer1:

We had the same issue, within our company, and the only solution was to use the deprecated attribute sonar.profile (https://docs.sonarqube.org/display/SONAR/Analysis+Parameters).

Sidenote: Generally there is also a interesting view on how to analyze branches. The general recommendation from sonarSource suggests to only use preview modes for short living branches. As a fact bitbucket-plugins with a richer featureset than just commenting issues, sadly need branch based analysis.

https://jira.sonarsource.com/browse/SONAR-5370 - the property will be removed in 4.5.1 based on the sonar task

Answer2:

Use the api/projects/create web service to provision your projects. You can then call api/qualityprofiles/add_project to assign your new project to the proper profiles. (You'll need to have first looked up the profile id's tho with api/qualityprofiles/search.)

Recommend

  • command line sonarlint show only new issues
  • How to exclude/ignore referenced project(s) analysis from SoanrQube
  • SonarQube token access when LDAP is enabled
  • Sonarqube producing different results in different folders
  • Coverage report works in Jenkins using Jacoco but I cannot get coverage report in SonarQube
  • How to Use build-stability-plugin in sonar
  • How to increase Sonar java heap size?
  • Can't update data from sonarqube server
  • how to list methods with most cyclomatic complexity
  • Modify contents of Welcome widget in Sonar
  • Fail SonarQube quality gate when coverage decreases
  • NSOpenPanel's setDirectoryURL doesn't work on Lion
  • Java Date object constructor for getting string is deprecated
  • signer not valid error
  • GRPC and types import error in App Engine Datastore
  • unable to get jsonEncode in magento2
  • CodeIgniter URI Parameter is partially bypassing an “if” statement
  • Bash if statement with multiple conditions
  • Combining two different ActiveRecord collections into one
  • Sonar maven jacoco code coverage for Multimodule project
  • Zurb Foundation _global.scss meta styles for js?
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • ImageMagick, replace semi-transparent white with opaque white
  • Cannot connect to cassandra from Spark
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • RectangularRangeIndicator format like triangular using dojo
  • HTML download movie download link
  • Cross-Platform Protobuf Serialization
  • ActionScript 2 vs ActionScript 3 performance
  • To display the title for the current loaction in map in iphone
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • jQuery tmpl and DataLink beta
  • QuartzCore.framework for Mono Develop
  • RestKit - RKRequestDelegate does not exist
  • Traverse Array and Display in markup
  • Revoking OAuth Access Token Results in 404 Not Found
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • How to set the response of a form post action to a iframe source?
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass