Skip to content

Commit

Permalink
[JENKINS-44126] Include animal-sniffer, findbugs and codenarc (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evaristo Gutiérrez authored and wolfs committed May 9, 2017
1 parent e509a7c commit 4900ce0
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 5 deletions.
24 changes: 24 additions & 0 deletions build.gradle
@@ -1,5 +1,8 @@
plugins {
id "org.jenkins-ci.jpi" version "0.22.0"
id 'ru.vyarus.animalsniffer' version '1.3.0'
id 'findbugs'
id 'codenarc'
}

group = "org.jenkins-ci.plugins"
Expand Down Expand Up @@ -46,6 +49,8 @@ dependencies {
compileOnly 'org.jenkins-ci:symbol-annotation:1.3'
jenkinsPlugins 'org.jenkins-ci.plugins:structs:1.3@jar'

signature 'org.codehaus.mojo.signature:java17:1.0@signature'

testCompile 'org.spockframework:spock-core:0.7-groovy-1.8'
jenkinsTest 'org.jenkins-ci.main:jenkins-test-harness:2.8@jar'
}
Expand All @@ -56,6 +61,25 @@ if (project.hasProperty("maxParallelForks")) {
ext.maxParallelForks = 3
}

animalsniffer {
sourceSets = [sourceSets.main]
}

findbugs {
// Some errors are logged due to https://github.com/gradle/gradle/issues/1094, but Findbugs checks are working fine
toolVersion '3.0.0'
sourceSets = [sourceSets.main]
}

codenarc {
toolVersion '0.27.0'
sourceSets = [sourceSets.test]
}

configurations {
// https://github.com/gradle/gradle/issues/1305
compile.exclude group: 'com.ibm.icu', module: 'icu4j'
}

test {
systemProperties["hudson.model.DownloadService.noSignatureCheck"] = "true"
Expand Down
15 changes: 15 additions & 0 deletions config/codenarc/codenarc.xml
@@ -0,0 +1,15 @@
<ruleset xmlns="http://codenarc.org/ruleset/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://codenarc.org/ruleset/1.0 http://codenarc.org/ruleset-schema.xsd"
xsi:noNamespaceSchemaLocation="http://codenarc.org/ruleset-schema.xsd">
<ruleset-ref path='rulesets/basic.xml'>
</ruleset-ref>
<ruleset-ref path='rulesets/braces.xml'/>
<ruleset-ref path='rulesets/concurrency.xml'/>
<ruleset-ref path='rulesets/design.xml'>
<exclude name="PublicInstanceField"/> <!-- JUnit rules -->
</ruleset-ref>
<ruleset-ref path='rulesets/dry.xml'/>
<ruleset-ref path='rulesets/exceptions.xml'/>
<ruleset-ref path='rulesets/groovyism.xml'/>
<ruleset-ref path='rulesets/imports.xml'/>
</ruleset>
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/gradle/GetGradleCommand.java
Expand Up @@ -85,7 +85,7 @@ protected int run() throws Exception {
}

GradleInstallation[] installations =
Jenkins.getInstance().getDescriptorByType(GradleInstallation.DescriptorImpl.class).getInstallations();
Jenkins.getActiveInstance().getDescriptorByType(GradleInstallation.DescriptorImpl.class).getInstallations();

Map<String,List<String>> map = new HashMap<String,List<String>>();

Expand Down
Expand Up @@ -12,7 +12,7 @@ class GradleInstallationRule extends TestWatcher {
}

String gradleVersion
private JenkinsRule j
private final JenkinsRule j

GradleInstallationRule(String gradleVersion = '3.2.1', JenkinsRule j) {
this.gradleVersion = gradleVersion
Expand Down
Expand Up @@ -24,6 +24,8 @@

package hudson.plugins.gradle

import static org.jvnet.hudson.test.JenkinsRule.getLog

import com.gargoylesoftware.htmlunit.html.HtmlButton
import com.gargoylesoftware.htmlunit.html.HtmlForm
import com.gargoylesoftware.htmlunit.html.HtmlPage
Expand All @@ -38,7 +40,6 @@ import org.jvnet.hudson.test.CreateFileBuilder
import org.jvnet.hudson.test.JenkinsRule.WebClient
import spock.lang.Unroll

import static org.jvnet.hudson.test.JenkinsRule.getLog
/**
* Tests for the Gradle build step.
*/
Expand Down
@@ -1,5 +1,7 @@
package hudson.plugins.gradle

import static org.jvnet.hudson.test.JenkinsRule.getLog

import hudson.model.Cause
import hudson.model.FreeStyleBuild
import hudson.model.FreeStyleProject
Expand All @@ -12,8 +14,6 @@ import hudson.remoting.Launcher
import org.jvnet.hudson.test.CreateFileBuilder
import spock.lang.Unroll

import static org.jvnet.hudson.test.JenkinsRule.getLog

@Unroll
class PropertyPassingIntegrationTest extends AbstractIntegrationTest {
def "pass '#escapedPropertyValue' via parameter in system properties"() {
Expand Down

0 comments on commit 4900ce0

Please sign in to comment.