Class CodeSonarJobDslExtension

java.lang.Object
javaposse.jobdsl.plugin.ContextExtensionPoint
org.jenkinsci.plugins.codesonar.CodeSonarJobDslExtension
All Implemented Interfaces:
ExtensionPoint

@Extension(optional=true) public class CodeSonarJobDslExtension extends javaposse.jobdsl.plugin.ContextExtensionPoint
Implement extension point for job-dsl plugin.

The job-dsl plugin allows one to generate new Jenkins projects from a script. This extension point implementation allows one to declare the use of the CodeSonar plugin in their job-dsl script.

This is the general structure:


job {
    publishers {
        codesonar(String protocol, String hubAddress, String projectName, String credentialId, String visibilityFilter) {
            socketTimeoutMS(int value)
            sslCertificateCredentialId(String value)
            projectFile(String value)
            newWarningsFilter(String value)
            comparisonAnalysis(String value)
            cyclomaticComplexity(int max, boolean fail)
            redAlert(int max, boolean fail)
            yellowAlert(int max, boolean fail)
            newWarningCountIncrease(float percentage, boolean fail)
            overallWarningCountIncrease(float percentage, boolean fail)
            rankedWarningCountIncrease(int rank, float percentage, boolean fail)
            absoluteWarningCount(int rank, int count, boolean fail)
        }
    }
}

For example:

job('myProject_GEN') {
    publishers {
        codesonar('https','codesonarhub.com:7340','MyProjectName','codesonar_hub_credential_id','active') {
            socketTimeoutMS(0)
            sslCertificateCredentialId('codesonar_hub_server_certificate_id')
            projectFile('MyProjectFile')
            newWarningsFilter('new')
            comparisonAnalysis('MyBaseAnalysisId')
            cyclomaticComplexity(20, false)
            redAlert(3, true)
            yellowAlert(10, false)
            newWarningCountIncrease(5.0, true)
            overallWarningCountIncrease(5.0, false)
            rankedWarningCountIncrease(30, 5.0, true)
            absoluteWarningCount(20,10,false)
        }
    }
}

  • Constructor Details

    • CodeSonarJobDslExtension

      public CodeSonarJobDslExtension()
  • Method Details

    • codesonar

      @RequiresPlugin(id="codesonar", minimumVersion="3.3.0") @DslExtensionMethod(context=javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.class) public Object codesonar(String protocol, String hubAddress, String projectName, String credentialId, String visibilityFilter, Runnable closure)
    • codesonar

      public Object codesonar(String protocol, String hubAddress, String projectName, Runnable closure)