Skip to content

Commit

Permalink
Add staticAnalysisCI profile (#564)
Browse files Browse the repository at this point in the history
* Add staticAnalysisCI profile
* Run detekt in 'test' phase if -DstaticAnalysis[CI]
  • Loading branch information
seanf committed Oct 9, 2017
1 parent ad2952a commit 6b9b77f
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 38 deletions.
3 changes: 1 addition & 2 deletions Jenkinsfile
Expand Up @@ -214,7 +214,7 @@ timestamps {
clean install jxr:aggregate \
--batch-mode \
--update-snapshots \
-DstaticAnalysis \
-DstaticAnalysisCI \
$gwtOpts \
-DskipFuncTests \
-DskipArqTests \
Expand Down Expand Up @@ -285,7 +285,6 @@ timestamps {
//step([$class: 'PmdPublisher', pattern: '**/target/pmd.xml', unstableTotalAll:'0'])
//step([$class: 'DryPublisher', canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '**/cpd/cpdCheck.xml', unHealthy: ''])

// TODO reduce unstableTotal thresholds as bugs are eliminated
step([$class: 'FindBugsPublisher',
pattern: '**/findbugsXml.xml',
unstableTotalAll: '0'])
Expand Down
37 changes: 35 additions & 2 deletions parent/pom.xml
Expand Up @@ -924,23 +924,56 @@
</profile>

<profile>
<!-- This profile is for *strict* local builds - the Maven build fails
if there is a problem -->
<id>staticAnalysis</id>
<activation>
<property>
<name>staticAnalysis</name>
<value>true</value>
</property>
</activation>
<build>
<properties>
<animal.sniffer.skip>false</animal.sniffer.skip>
<checkstyle.failOnViolation>true</checkstyle.failOnViolation>
<checkstyle.skip>false</checkstyle.skip>
<dupfind.skip>false</dupfind.skip>
<enforcer.skip>false</enforcer.skip>
<findbugs.skip>false</findbugs.skip>
<!-- takari doesn't support this yet: https://github.com/takari/takari-lifecycle/issues/39 -->
<maven.compiler.failOnWarning>true</maven.compiler.failOnWarning>
<mdep.analyze.skip>false</mdep.analyze.skip>
<!-- restrict-maven-plugin -->
<restrict.skip>false</restrict.skip>
</properties>
</profile>

</build>
<profile>
<!-- For Jenkins, we want to run static analysis, but for some plugins we
don't want Maven to fail the build - Jenkins will. (With some plugins, we
don't have that control, or Jenkins doesn't know how to check the
output.) -->
<id>staticAnalysisCI</id>
<activation>
<property>
<name>staticAnalysisCI</name>
<value>true</value>
</property>
</activation>
<properties>
<animal.sniffer.skip>false</animal.sniffer.skip>
<!-- These violations will be picked up by CheckStylePublisher -->
<checkstyle.failOnViolation>false</checkstyle.failOnViolation>
<checkstyle.skip>false</checkstyle.skip>
<dupfind.skip>false</dupfind.skip>
<enforcer.skip>false</enforcer.skip>
<!-- These violations will be picked up by FindBugsPublisher -->
<findbugs.failOnError>true</findbugs.failOnError>
<findbugs.skip>false</findbugs.skip>
<!-- These violations will be picked up by WarningsPublisher -->
<maven.compiler.failOnWarning>false</maven.compiler.failOnWarning>
<mdep.analyze.skip>false</mdep.analyze.skip>
<!-- restrict-maven-plugin -->
<restrict.skip>false</restrict.skip>
</properties>
</profile>
Expand Down
96 changes: 62 additions & 34 deletions server/pom.xml
Expand Up @@ -2160,7 +2160,44 @@
</target>
</configuration>
</execution>
<execution>
<!-- This can be run separately with mvn antrun:run@detekt -->
<id>detekt</id>
<!-- Profiles should use 'test' to activate this -->
<phase>none</phase>
<goals><goal>run</goal></goals>
<configuration>
<target name="detekt">
<java taskname="detekt" dir="${basedir}" fork="true" failonerror="true"
classname="io.gitlab.arturbosch.detekt.cli.Main" classpathref="maven.plugin.classpath">
<arg value="--config-resource"/>
<arg value="zanata-build-tools/detekt.yml"/>
<arg value="--project"/>
<arg value="${basedir}/src"/>
<arg value="--filters"/>
<arg value=".*test.*"/>
</java>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.zanata</groupId>
<artifactId>build-tools</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.gitlab.arturbosch.detekt</groupId>
<artifactId>detekt-cli</artifactId>
<version>1.0.0.M11</version>
</dependency>
<dependency>
<groupId>io.gitlab.arturbosch.detekt</groupId>
<artifactId>detekt-formatting</artifactId>
<version>1.0.0.M11</version>
</dependency>
</dependencies>
</plugin>
</plugins>

Expand Down Expand Up @@ -2393,49 +2430,40 @@
<value>true</value>
</property>
</activation>
<!-- With kotlin-maven-plugin 1.2, we should be able to use <args>-Werror</args> -->
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<!--<version>1.8</version>-->
<executions>
<execution>
<!-- This can be run separately with mvn antrun:run@detekt -DstaticAnalysis -->
<id>detekt</id>
<phase>verify</phase>
<configuration>
<target name="detekt">
<java taskname="detekt" dir="${basedir}" fork="true" failonerror="true"
classname="io.gitlab.arturbosch.detekt.cli.Main" classpathref="maven.plugin.classpath">
<arg value="--config-resource"/>
<arg value="zanata-build-tools/detekt.yml"/>
<arg value="--project"/>
<arg value="${basedir}/src"/>
<arg value="--filters"/>
<arg value=".*test.*"/>
</java>
</target>
</configuration>
<goals><goal>run</goal></goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>staticAnalysisCI</id>
<activation>
<property>
<name>staticAnalysisCI</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>detekt</id>
<phase>test</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.zanata</groupId>
<artifactId>build-tools</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.gitlab.arturbosch.detekt</groupId>
<artifactId>detekt-cli</artifactId>
<version>1.0.0.M11</version>
</dependency>
<dependency>
<groupId>io.gitlab.arturbosch.detekt</groupId>
<artifactId>detekt-formatting</artifactId>
<version>1.0.0.M11</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down

0 comments on commit 6b9b77f

Please sign in to comment.