Skip to content

Commit

Permalink
added checkstyle, findbugs and pmd plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
sephiroth74 committed Nov 17, 2014
1 parent a42db68 commit 426b56c
Show file tree
Hide file tree
Showing 11 changed files with 335 additions and 25 deletions.
Expand Up @@ -12,7 +12,7 @@
import it.sephiroth.android.library.viewrevealanimator.ViewRevealAnimator;

public class MainActivity extends ActionBarActivity
implements View.OnClickListener, ViewRevealAnimator.onViewAnimationListener, ViewRevealAnimator.OnViewChangedListener {
implements View.OnClickListener, ViewRevealAnimator.OnViewAnimationListener, ViewRevealAnimator.OnViewChangedListener {
private static final String TAG = "MainActivity";
ViewRevealAnimator mViewAnimator;

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Expand Up @@ -15,7 +15,7 @@
android:id="@+id/animator"
android:layout_width="200dip"
android:layout_height="200dip"
android:animationDuration="@android:integer/config_mediumAnimTime"
android:animationDuration="@android:integer/config_longAnimTime"
android:animateFirstView="true"
android:measureAllChildren="true"
app:vra_animationsEnabled="true"
Expand Down
63 changes: 63 additions & 0 deletions config/quality.gradle
@@ -0,0 +1,63 @@
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'

check.dependsOn 'checkstyle', 'findbugs', 'pmd'


task checkstyle(type: Checkstyle) {
description 'Run CheckStyle'
group 'verification'

configFile file("${project.rootDir}/config/quality/checkstyle/checkstyle.xml")
source 'src'
include '**/*.java'
exclude '**/gen/**'

classpath = files()
}

task findbugs(type: FindBugs) {
description 'Run FindBugs'
group 'verification'

ignoreFailures = true
effort = "max"
reportLevel = "high"
excludeFilter = new File("${project.rootDir}/config/quality/findbugs/findbugs-filter.xml")
classes = files("$project.buildDir/intermediates/classes/")

source 'src'
include '**/*.java'
exclude '**/gen/**'

reports {
xml {
enabled = false
withMessages true
}
html {
enabled = true
}
}

classpath = files()
}

task pmd(type: Pmd) {
description 'Run PMD'
group 'verification'

ignoreFailures = true
//ruleSets = ["basic", "braces", "strings", "design", "unusedcode"]
ruleSets = ["java-basic", "java-design"]
source = fileTree('src/main/java')

include '**/*.java'
exclude '**/gen/**'

reports {
xml.enabled = false
html.enabled = true
}
}
159 changes: 159 additions & 0 deletions config/quality/checkstyle/checkstyle.xml
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd"><!-- This configuration file was written by the eclipse-cs plugin configuration editor --><!--
Checkstyle-Configuration: Android Checkstyle
Description: none
-->
<module name="Checker">

<!--<property name="severity" value="warning" />-->

<module name="FileLength">
<property name="max" value="3000" />
</module>

<module name="FileTabCharacter" />

<!-- Trailing spaces -->
<module name="RegexpSingleline">
<property name="format" value="\s+$" />
<property name="message" value="Line has trailing spaces." />
</module>

<!-- Space after 'for' and 'if' -->
<module name="RegexpSingleline">
<property name="format" value="^\s*(for|if)[^ ]\(" />
<property name="message" value="Space needed before opening parenthesis." />
</module>

<!-- For each spacing -->
<module name="RegexpSingleline">
<property name="format" value="^\s*for \(.*?([^ ]:|:[^ ])" />
<property name="message" value="Space needed around ':' character." />
</module>

<module name="NewlineAtEndOfFile">
<property name="severity" value="ignore" />
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
</module>

<!-- exclusions -->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)" />
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)" />
<property name="checkFormat" value="$1" />
</module>

<module name="SuppressWarningsFilter" />

<module name="Translation" />

<module name="TreeWalker">
<property name="cacheFile" value="target/cachefile" />

<property name="tabWidth" value="4" />

<module name="ArrayTypeStyle" />
<module name="AvoidNestedBlocks" />
<module name="AvoidStarImport" />
<module name="ConstantName">
<property name="format" value="^(_)?[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$" />
</module>
<module name="CovariantEquals" />
<module name="CyclomaticComplexity">
<property name="max" value="15" />
</module>
<module name="DesignForExtension">
<property name="severity" value="ignore" />
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
</module>
<!--<module name="EmptyBlock" />-->
<module name="EmptyBlock">
<property name="option" value="text" />
<property name="tokens"
value="LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, INSTANCE_INIT, STATIC_INIT" />
</module>
<module name="EmptyForIteratorPad" />
<module name="EmptyStatement" />
<module name="EqualsHashCode" />
<module name="FileContentsHolder" />
<module name="FinalClass" />
<module name="FinalParameters">
<property name="severity" value="ignore" />
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
</module>
<module name="GenericWhitespace" />
<module name="HideUtilityClassConstructor" />
<module name="IllegalImport" />
<module name="IllegalInstantiation" />
<module name="InnerAssignment" />
<!--<module name="InterfaceIsType" />-->
<!--<module name="InnerTypeLast" />-->
<module name="LeftCurly" />
<module name="LineLength">
<property name="max" value="132" />
</module>
<module name="LocalFinalVariableName" />
<module name="LocalVariableName" />

<!-- Checks that there are no "magic numbers", where a magic number is a numeric literal that is not defined as a constant. -->
<module name="MagicNumber">
<property name="tokens" value="NUM_DOUBLE, NUM_FLOAT" />
<property name="ignoreNumbers" value="0, 0.5, -0.5, 1, -1, -2, 2" />
</module>

<module name="MemberName" />
<module name="MethodLength">
<property name="tokens" value="METHOD_DEF" />
<property name="max" value="200" />
<property name="countEmpty" value="false" />
</module>
<module name="MethodName" />
<module name="MethodParamPad" />
<module name="MissingSwitchDefault" />
<module name="ModifierOrder" />
<module name="NeedBraces">
<property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE" />
</module>
<module name="NoWhitespaceAfter">
<!--<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS" />-->
</module>
<module name="NoWhitespaceBefore" />
<module name="OperatorWrap" />
<module name="PackageName" />
<module name="ParameterName" />
<module name="ParameterNumber">
<property name="max" value="12" />
</module>
<module name="ParenPad" />
<module name="RightCurly" />
<module name="RedundantImport" />
<module name="RedundantModifier" />
<module name="RedundantThrows">
<property name="allowUnchecked" value="true" />
<property name="allowSubclasses" value="true" />
<property name="suppressLoadErrors" value="true" />
</module>
<module name="SimplifyBooleanExpression" />
<module name="SimplifyBooleanReturn" />
<module name="StaticVariableName" />
<module name="StringLiteralEquality" />
<module name="SuperFinalize" />
<module name="SuppressWarningsHolder" />
<module name="TodoComment">
<property name="severity" value="ignore" />
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit" />
</module>
<module name="TypecastParenPad" />
<module name="TypeName" />
<module name="UnusedImports">
<property name="processJavadoc" value="true" />
</module>
<module name="UpperEll" />
<module name="WhitespaceAfter" />
<module name="WhitespaceAround">
<property name="allowEmptyMethods" value="true" />
</module>

<!-- <module name="HiddenField"/> -->
</module>
</module>
17 changes: 17 additions & 0 deletions config/quality/findbugs/findbugs-filter.xml
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<!-- http://stackoverflow.com/questions/7568579/eclipsefindbugs-exclude-filter-files-doesnt-work -->
<Match>
<Class name="~.*\.R\$.*" />
</Match>
<Match>
<Class name="~.*\.Manifest\$.*" />
</Match>
<!-- All bugs in test classes, except for JUnit-specific bugs -->
<Match>
<Class name="~.*\.*Test" />
<Not>
<Bug code="IJU" />
</Not>
</Match>
</FindBugsFilter>
9 changes: 9 additions & 0 deletions config/quality/pmd/pmd-ruleset.xml
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
This ruleset checks my code for bad stuff
</description>
</ruleset>
4 changes: 2 additions & 2 deletions gradle.properties
@@ -1,5 +1,5 @@
VERSION_NAME=1.0.1-SNAPSHOT
VERSION_CODE=2
VERSION_NAME=1.0.2
VERSION_CODE=4
GROUP=it.sephiroth.android.library.viewrevealanimator

POM_DESCRIPTION=ViewAnimator with reveal effect
Expand Down
1 change: 1 addition & 0 deletions library/build.gradle
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply from: "${project.rootDir}/config/quality.gradle"

group GROUP
version VERSION_NAME
Expand Down

0 comments on commit 426b56c

Please sign in to comment.