Skip to content

Commit

Permalink
maven plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
turaaa committed May 27, 2014
1 parent 17fb4f2 commit 2233fa6
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 14 deletions.
123 changes: 123 additions & 0 deletions checkstyle-checker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<!--
Checkstyle configuration that checks the sun coding conventions from:
- the Java Language Specification at
http://java.sun.com/docs/books/jls/second_edition/html/index.html
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
- the Javadoc guidelines at
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
- some best practices
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
Most Checks are configurable, be sure to consult the documentation.
To completely disable a check, just comment it out or delete it from the file.
Finally, it is worth reading the documentation.
-->

<module name="Checker">

<property name="severity" value="error"/>

<module name="SuppressionFilter">
<property name="file" value="checkstyle-suppressions.xml"/>
</module>

<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>

<module name="FileLength">
<property name="fileExtensions" value="java"/>
</module>

<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Trailing whitespace detected"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
</module>

<module name="TreeWalker">
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<property name="tabWidth" value="4"/>

<module name="AvoidStarImport"/>
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="IllegalImport"/>
<module name="IllegalInstantiation"/>
<module name="ImportOrder"/>
<module name="LeftCurly"/>
<module name="LineLength">
<property name="max" value="160"/>
</module>
<module name="MethodLength">
<property name="max" value="200"/>
<property name="countEmpty" value="false"/>
</module>
<module name="MethodParamPad"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
<module name="ModifiedControlVariable"/>
<module name="NeedBraces"/>
<module name="NestedIfDepth">
<property name="max" value="4"/>
</module>
<module name="NestedTryDepth">
<property name="max" value="3"/>
</module>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore">
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="OneStatementPerLine"/>
<module name="OperatorWrap">
<property name="tokens" value="ASSIGN, DIV_ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN, STAR_ASSIGN, MOD_ASSIGN, SR_ASSIGN, BSR_ASSIGN, SL_ASSIGN, BXOR_ASSIGN, BOR_ASSIGN, BAND_ASSIGN"/>
<property name="option" value="eol"/>
</module>
<module name="OuterTypeFilename"/>
<module name="OuterTypeNumber"/>
<module name="PackageAnnotation"/>
<module name="PackageDeclaration"/>
<module name="PackageName"/>
<module name="ParameterNumber">
<property name="id" value="paramNum"/>
<property name="max" value="20"/>
</module>
<module name="ParenPad"/>
<module name="RedundantImport"/>
<module name="RightCurly"/>
<module name="SimplifyBooleanExpression"/>
<module name="StringLiteralEquality"/>
<module name="SuppressWarnings"/>
<module name="TypecastParenPad"/>
<module name="TypeName">
<property name="format" value="^[A-Z][a-zA-Z0-9_]*$"/>
</module>
<module name="UnusedImports"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
</module>
</module>
</module>
12 changes: 12 additions & 0 deletions checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.0//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">

<suppressions>
<suppress checks="ModifiedControlVariable" files="MessageFormatter\.java"/>
<suppress checks="MethodLengthCheck|ModifiedControlVariable" files="SortScoresWithDocIds\.java"/>
<suppress checks="ParameterNumberCheck" files="UserService\.java"/>
<suppress checks=".*" files="target/generated-sources/|com/twitter/zipkin/gen"/>
<suppress checks="FileLength" files="test/java/"/>
</suppressions>
74 changes: 64 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,12 @@
<version>0.3.11</version>
<!-- TODO upgrade to 0.3.12 -->
</dependency>
<dependency>
<groupId>jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.17</version>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>

<dependency>
<groupId>junit</groupId>
Expand All @@ -75,6 +66,16 @@
<artifactId>bcprov-jdk15on</artifactId>
<version>1.50</version>
</dependency>
<!-- <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.17</version>
</dependency> -->
</dependencies>


Expand All @@ -101,6 +102,59 @@
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.12.1</version>
<configuration>
<propertyExpansion>config_loc=.</propertyExpansion>
<configLocation>checkstyle-checker.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failOnViolation>false</failOnViolation>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.4</version>
<configuration>
<failOnError>false</failOnError>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>analyze</id>
<goals>
<goal>analyze-only</goal>
</goals>
<configuration>
<failOnWarning>true</failOnWarning>
<ignoreNonCompile>true</ignoreNonCompile>
<outputXML>true</outputXML>
<usedDependencies combine.children="override"></usedDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ public static void addDefaultHeader(HttpClient httpClient, boolean removeHeader,
headerSet = new HashSet<Header>();
clientParams.setParameter(HTTP_DEFAULT_HEADERS, headerSet);
}
if (!headerSet.contains(headerName) && !removeHeader) {
Header header1 = new Header(headerName, headervalue);
Header header1 = new Header(headerName, headervalue);
if (!headerSet.contains(header1) && !removeHeader) {
headerSet.add(header1);
} else if (headerSet.contains(headerName) && removeHeader) {
headerSet.remove(headerName);
} else if (headerSet.contains(header1) && removeHeader) {
headerSet.remove(header1);
}
}

Expand Down

0 comments on commit 2233fa6

Please sign in to comment.