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 (optional)
      • Type: String
    • password (optional)
      This field will override the HTTP password from Gerrit Trigger settings and will be used for plugin purposes only.
      • Type: String
    • secretPassword (optional)
      • Type: class hudson.util.Secret
    • username (optional)
      This field will override the HTTP username from Gerrit Trigger settings and will be used for plugin purposes only.
      • Type: String
  • category (optional)
    • Type: String
  • changedLinesOnly (optional)
    • Type: boolean
  • httpPassword (optional)
    • Type: String
  • httpUsername (optional)
    • Type: String
  • 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 (optional)
          Allow plugin to match inspection and review system file names automatically (useful for projects with several nested modules)
          • Type: boolean
        • baseConfig (optional)
          Provides settings for the whole project
            Nested Object
          • autoMatch (optional)
            • Type: boolean
          • projectPath (optional)
            Provides module prefix for a file path for multi-module projects
            • Type: String
          • sonarReportPath (optional)
            Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"
            • Type: String
        • sonarQubeInstallationName (optional)
          • Type: String
        • subJobConfigs (optional)
          Provides separate settings for each module
            Array / List of Nested Object
          • autoMatch (optional)
            • Type: boolean
          • projectPath (optional)
            Provides module prefix for a file path for multi-module projects
            • Type: String
          • sonarReportPath (optional)
            Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"
            • Type: String
        • type (optional)
          • Type: String
      • pullRequest
      • autoMatch (optional)
        • Type: boolean
      • baseConfig (optional)
          Nested Object
        • autoMatch (optional)
          • Type: boolean
        • projectPath (optional)
          Provides module prefix for a file path for multi-module projects
          • Type: String
        • sonarReportPath (optional)
          Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"
          • Type: String
      • serverURL (optional)
        • Type: String
      • sonarQubeInstallationName (optional)
        • Type: String
      • subJobConfigs (optional)
          Array / List of Nested Object
        • autoMatch (optional)
          • Type: boolean
        • projectPath (optional)
          Provides module prefix for a file path for multi-module projects
          • Type: String
        • sonarReportPath (optional)
          Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"
          • Type: String
      • type (optional)
        • Type: String
    • issueComment (optional)
      • Type: String
    • issuesNotification (optional)
      • Type: String
    • issuesScore (optional)
      • Type: String
    • newIssuesOnly (optional)
      • Type: boolean
    • noIssuesNotification (optional)
      • Type: String
    • noIssuesScore (optional)
      • Type: String
    • noIssuesToPostText (optional)
      • Type: String
    • notificationConfig (optional)
        Nested Object
      • commentedIssuesNotificationRecipient (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.

        • Type: String
      • negativeScoreNotificationRecipient (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.

        • Type: String
      • noIssuesNotificationRecipient (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.

        • Type: String
    • overrideCredentials (optional)
      • Type: boolean
    • path (optional)
      • Type: String
    • postScore (optional)
      • Type: boolean
    • projectPath (optional)
      • Type: String
    • 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 (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.
        • Type: String
      • issueFilterConfig (optional)
        Issue filter to specify issues to be commented in Gerrit
          Nested Object
        • changedLinesOnly (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.
          • Type: boolean
        • newIssuesOnly (optional)
          Only new SonarQube issues to be commented in Gerrit when checked. Modified files to be commented with all corresponding issues when unchecked.
          • Type: boolean
        • severity (optional)
          Minimum level of SonarQube severity to be reported to Gerrit.
          • Type: String
      • noIssuesTitleTemplate (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.
        • Type: String
      • someIssuesTitleTemplate (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.
        • Type: String
    • scoreConfig (optional)
        Nested Object
      • category (optional)
        This field describes under what category score will appear in Gerrit. This category should match one of existent Gerrit categories.
        • Type: String
      • issueFilterConfig (optional)
        Issue filter to specify issues to affect score in Gerrit
          Nested Object
        • changedLinesOnly (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.
          • Type: boolean
        • newIssuesOnly (optional)
          Only new SonarQube issues to be commented in Gerrit when checked. Modified files to be commented with all corresponding issues when unchecked.
          • Type: boolean
        • severity (optional)
          Minimum level of SonarQube severity to be reported to Gerrit.
          • Type: String
      • issuesScore (optional)
        Score to be posted to Gerrit in case when there are SonarQube violations found
        • Type: int
      • noIssuesScore (optional)
        Score to be posted to Gerrit in case when there are no SonarQube violations found
        • Type: int
    • severity (optional)
      • Type: String
    • someIssuesToPostText (optional)
      • Type: String
    • sonarURL (optional)
      • Type: String
    • subJobConfigs (optional)
        Array / List of Nested Object
      • autoMatch (optional)
        • Type: boolean
      • projectPath (optional)
        Provides module prefix for a file path for multi-module projects
        • Type: String
      • sonarReportPath (optional)
        Path to SonarQube report on Jenkins server. Default value is "target/sonar/sonar-report.json"
        • Type: String

    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.