Skip to content

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files

License

Notifications You must be signed in to change notification settings

frol2103/sonar-gitlab-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sonar GitLab Plugin

Forked from https://github.com/SonarCommunity/sonar-github

Goal

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files.

Comment commits: Comment commits

Comment line: Comment line

Add build line: Add buids

Usage

For SonarQube <5.4:

For SonarQube >=5.4:

Other Plugin: Add Single Sign-On with GitLab in SonarQube

Command line

Example :

mvn --batch-mode verify sonar:sonar -Dsonar.host.url=$SONAR_URL -Dsonar.analysis.mode=preview -Dsonar.issuesReport.console.enable=true -Dsonar.gitlab.commit_sha=$CI_BUILD_REF -Dsonar.gitlab.ref=$CI_BUILD_REF_NAME
Variable Comment Type
sonar.gitlab.url GitLab url Administration, Variable
sonar.gitlab.max_global_issues Maximum number of anomalies to be displayed in the global comment Administration, Variable
sonar.gitlab.user_token Token of the user who can make reports on the project, either global or per project Administration, Project, Variable
sonar.gitlab.project_id Project ID in GitLab or internal id or namespace + name or namespace + path or url http or ssh url or url or web Project, Variable
sonar.gitlab.commit_sha SHA of the commit comment Variable
sonar.gitlab.ref_name Branch name or reference of the commit Variable
  • Administration : Settings globals in SonarQube
  • Project : Settings of project in SonarQube
  • Variable : In an environment variable or in the pom.xml either from the command line with -D

Configuration

  • In SonarQube: Administration -> General Settings -> GitLab -> Reporting. Set GitLab Url and Token

Sonar settings

  • In SonarQube: Project Administration -> General Settings -> GitLab -> Reporting. Set project identifier in GitLab

Sonar settings

About

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%