The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Sonar Gerrit Plugin

sonarToGerrit: Post SonarQube issues as Gerrit comments

  • authConfig (optional)
    Override HTTP credentials specified in Gerrit Trigger settings to be used for review posting
      Nested Object
    • httpCredentialsId : String (optional)
    • password : String (optional)
      This field will override the HTTP password from Gerrit Trigger settings and will be used for plugin purposes only.
    • secretPassword (optional)
      • Type: class hudson.util.Secret
    • username : String (optional)
      This field will override the HTTP username from Gerrit Trigger settings and will be used for plugin purposes only.
  • category : String (optional)
  • changedLinesOnly : boolean (optional)
  • httpPassword : String (optional)
  • httpUsername : String (optional)
  • inspectionConfig (optional)
    Configure accordance of SonarQube report(s) and project or module(s) path(s)
      Nested Object
    • analysisStrategy (optional)
        Nested Choice of Objects
      • previewMode
        • autoMatch : boolean (optional)
          Allow plugin to match inspection and review system file names automatically (useful for projects with several nested modules)
        • baseConfig (optional)
          Provides settings for the whole project
            Nested Object
          • autoMatch : boolean (optional)
          • projectPath : String (optional)
            Provides module prefix for a file path for multi-module projects
          • sonarReportPath : String (optional)
            Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"
        • sonarQubeInstallationName : String (optional)
        • subJobConfigs (optional)
          Provides separate settings for each module
            Array / List of Nested Object
          • autoMatch : boolean (optional)
          • projectPath : String (optional)
            Provides module prefix for a file path for multi-module projects
          • sonarReportPath : String (optional)
            Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"
        • type : String (optional)
      • pullRequest
      • autoMatch : boolean (optional)
      • baseConfig (optional)
          Nested Object
        • autoMatch : boolean (optional)
        • projectPath : String (optional)
          Provides module prefix for a file path for multi-module projects
        • sonarReportPath : String (optional)
          Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"
      • serverURL : String (optional)
      • sonarQubeInstallationName : String (optional)
      • subJobConfigs (optional)
          Array / List of Nested Object
        • autoMatch : boolean (optional)
        • projectPath : String (optional)
          Provides module prefix for a file path for multi-module projects
        • sonarReportPath : String (optional)
          Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"
      • type : String (optional)
    • issueComment : String (optional)
    • issuesNotification : String (optional)
    • issuesScore : String (optional)
    • newIssuesOnly : boolean (optional)
    • noIssuesNotification : String (optional)
    • noIssuesScore : String (optional)
    • noIssuesToPostText : String (optional)
    • notificationConfig (optional)
        Nested Object
      • commentedIssuesNotificationRecipient : String (optional)
        This setting allow to determine who will be notified in case there are several SonarQube issues matching filter settings found in particular commit.
        An e-mails sent to recipients will contain review information: title of review and list of comments (issues). Recipient settings:

        * None - No one;
        * Owner - Owner (i.e. author of the commit);
        * Owner and Reviewers - Owner (i.e. author of the commit) and all Reviewers (people who was added to reviewer list of the commit);
        * All - everyone in the project list.

      • negativeScoreNotificationRecipient : String (optional)
        This setting allow to determine who will be notified in case if the build got a negative score due to issues matching score filter settings are found. An e-mails sent to recipients will contain review information: title of review and list of comments (issues). Recipient settings:

        * None - No one;
        * Owner - Owner (i.e. author of the commit);
        * Owner and Reviewers - Owner (i.e. author of the commit) and all Reviewers (people who was added to reviewer list of the commit);
        * All - everyone in the project list.

      • noIssuesNotificationRecipient : String (optional)
        This setting allow to determine who will be notified in case there are no SonarQube issues matching filter settings found in particular commit.
        An e-mails sent to recipients will contain review information: title of review. Recipient settings:

        * None - No one;
        * Owner - Owner (i.e. author of the commit);
        * Owner and Reviewers - Owner (i.e. author of the commit) and all Reviewers (people who was added to reviewer list of the commit);
        * All - everyone in the project list.

    • overrideCredentials : boolean (optional)
    • path : String (optional)
    • postScore : boolean (optional)
    • projectPath : String (optional)
    • reviewConfig (optional)
        Nested Object
      • commentType (optional)
        Posted review comments can be of one of the following types :
        • Standard - The usual review comment that everyone use.
        • Robot - Available since Gerrit 2.14. Review comment type to be used by robots. See robot comment documentation for more details.
        • Values: STANDARD, ROBOT
      • issueCommentTemplate : String (optional)
        This text will appear as comment for a line with SonarQube issue in Gerrit review.
        There are some tags available:

        * <key> - will be replaced with issue key;
        * <component> - will be replaced with issue component info;
        * <message> - will be replaced with issue message;
        * <severity> - will be replaced with issue severity;
        * <rule> - will be replaced with issue rule name;
        * <rule_url> - will be replaced with link to rule description on SonarQube if SonarQube URL is provided in SonarQube settings section or rule name if URL is not provided;
        * <status> - will be replaced with issue status;
        * <creation_date> - will be replaced with issue creation date.

        Please note that only filtered by severity level issues and their counts will be shown in report.
      • issueFilterConfig (optional)
        Issue filter to specify issues to be commented in Gerrit
          Nested Object
        • changedLinesOnly : boolean (optional)
          Only changed in current commit lines to be commented by Gerrit when checked. Modified files to be commented with all issues if this control unchecked.
        • excludedPathsGlobPattern : String (optional)
        • includedPathsGlobPattern : String (optional)
        • newIssuesOnly : boolean (optional)
          Only new SonarQube issues to be commented in Gerrit when checked. Modified files to be commented with all corresponding issues when unchecked.
        • severity : String (optional)
          Minimum level of SonarQube severity to be reported to Gerrit.
      • noIssuesTitleTemplate : String (optional)
        This text will appear as title of Gerrit review in case when no issues matching filter settings found.
        There are some tags available:

        * <info_count> - will be replaced with count of issues having INFO severity level;
        * <minor_count> - will be replaced with count of issues having MINOR severity level;
        * <major_count> - will be replaced with count of issues having MAJOR severity level;
        * <critical_count> - will be replaced with count of issues having CRITICAL severity level;
        * <blocker_count> - will be replaced with count of issues having BLOCKER severity level;
        * <min_minor_count> - will be replaced with count of issues having MINOR severity level or higher;
        * <min_major_count> - will be replaced with count of issues having MAJOR severity level or higher;
        * <min_critical_count> - will be replaced with count of issues having CRITICAL severity level or higher;
        * <total_count> - will be replaced with total count of issues.
        Please note that only filtered by severity level issues and their counts will be shown in report.
      • someIssuesTitleTemplate : String (optional)
        This text will appear as title of Gerrit review in case when there are several issues matching filter settings found.
        There are some tags available:

        * <info_count> - will be replaced with count of issues having INFO severity level;
        * <minor_count> - will be replaced with count of issues having MINOR severity level;
        * <major_count> - will be replaced with count of issues having MAJOR severity level;
        * <critical_count> - will be replaced with count of issues having CRITICAL severity level;
        * <blocker_count> - will be replaced with count of issues having BLOCKER severity level;
        * <min_minor_count> - will be replaced with count of issues having MINOR severity level or higher;
        * <min_major_count> - will be replaced with count of issues having MAJOR severity level or higher;
        * <min_critical_count> - will be replaced with count of issues having CRITICAL severity level or higher;
        * <total_count> - will be replaced with total count of issues.
        Please note that only filtered by severity level issues and their counts will be shown in report.
    • scoreConfig (optional)
        Nested Object
      • category : String (optional)
        This field describes under what category score will appear in Gerrit. This category should match one of existent Gerrit categories.
      • issueFilterConfig (optional)
        Issue filter to specify issues to affect score in Gerrit
          Nested Object
        • changedLinesOnly : boolean (optional)
          Only changed in current commit lines to be commented by Gerrit when checked. Modified files to be commented with all issues if this control unchecked.
        • excludedPathsGlobPattern : String (optional)
        • includedPathsGlobPattern : String (optional)
        • newIssuesOnly : boolean (optional)
          Only new SonarQube issues to be commented in Gerrit when checked. Modified files to be commented with all corresponding issues when unchecked.
        • severity : String (optional)
          Minimum level of SonarQube severity to be reported to Gerrit.
      • issuesScore : int (optional)
        Score to be posted to Gerrit in case when there are SonarQube violations found
      • noIssuesScore : int (optional)
        Score to be posted to Gerrit in case when there are no SonarQube violations found
    • severity : String (optional)
    • someIssuesToPostText : String (optional)
    • sonarURL : String (optional)
    • subJobConfigs (optional)
        Array / List of Nested Object
      • autoMatch : boolean (optional)
      • projectPath : String (optional)
        Provides module prefix for a file path for multi-module projects
      • sonarReportPath : String (optional)
        Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"

    Was this page helpful?

    Please submit your feedback about this page through this quick form.

    Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

        


    See existing feedback here.