Skip to content

Commit

Permalink
import project
Browse files Browse the repository at this point in the history
  • Loading branch information
Yacong Gu committed Sep 30, 2015
1 parent 173a3b3 commit c145310
Show file tree
Hide file tree
Showing 21 changed files with 2,312 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.gradle
local.properties
gradle.properties
.DS_Store
.idea
build
*.iml
24 changes: 24 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
group 'com.github.promeg'
version '1.0-SNAPSHOT'


buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
}
}

allprojects {
repositories {
jcenter()
}
}

ext {
groupName = 'com.github.promeg'
releaseVersion = "1.0.0"
}
55 changes: 55 additions & 0 deletions config/quality-android.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apply plugin: 'checkstyle'
apply plugin: 'findbugs'

checkstyle {
// will fire "java.lang.ClassNotFoundException: com.puppycrawl.tools.checkstyle
// .CheckStyleTask" with version 6.10.1
toolVersion '6.5'

configFile file('../config/quality/checkstyle/checkstyle.xml')

configProperties.checkstyleSuppressionFilterPath = file(
"${project.rootDir}/config/quality/checkstyle/suppressions.xml")
.absolutePath
}

task checkstyle(type: Checkstyle, group: 'verification') {
source 'src'
include '**/*.java'
exclude '**/gen/**'
exclude '**/R.java'
exclude '**/BuildConfig.java'

def configProps = ['proj.module.dir': projectDir.absolutePath]
configProperties configProps

// empty classpath
classpath = files()
}

findbugs {
toolVersion = "3.0.1"
ignoreFailures = false
effort = "max"
reportLevel = "high"
excludeFilter file('../config/quality/findbugs/findbugs-filter.xml')
}
task findbugs(type: FindBugs, group: 'verification') {
classes = files("${project.rootDir}/${project.getName()}/build/intermediates/classes")
source 'src'
include '**/*.java'
exclude '**/gen/**'

reports {
xml.enabled = false
html.enabled = true
xml {
destination "${project.rootDir}/${project.getName()}/build/reports/findbugs/findbugs.xml"
}
html {
destination "${project.rootDir}/${project.getName()}/build/reports/findbugs/findbugs.html"
}
}
classpath = files()
}

36 changes: 36 additions & 0 deletions config/quality-java.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apply plugin: 'checkstyle'
apply plugin: 'findbugs'

checkstyle {
// will fire "java.lang.ClassNotFoundException: com.puppycrawl.tools.checkstyle
// .CheckStyleTask" with version 6.10.1
toolVersion '6.5'

configFile file('../config/quality/checkstyle/checkstyle.xml')

configProperties.checkstyleSuppressionFilterPath = file(
"${project.rootDir}/config/quality/checkstyle/suppressions.xml")
.absolutePath
}

task checkstyle(type: Checkstyle, group: 'verification') {
source 'src'
include '**/*.java'
exclude '**/gen/**'
exclude '**/R.java'
exclude '**/BuildConfig.java'

def configProps = ['proj.module.dir': projectDir.absolutePath]
configProperties configProps

// empty classpath
classpath = files()
}

findbugs {
toolVersion = "3.0.1"
ignoreFailures = false
effort = "max"
reportLevel = "high"
excludeFilter file('../config/quality/findbugs/findbugs-filter.xml')
}
190 changes: 190 additions & 0 deletions config/quality/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<!-- Checkstyle configuration that checks RoboSpice conventions, quite close
from 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">
<!-- If you set the basedir property below, then all reported file names
will be relative to the specified directory. See http://checkstyle.sourceforge.net/5.x/config.html#Checker
<property name="basedir" value="${basedir}"/> -->

<!-- Checks that a package-info.java file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
<!-- <module name="JavadocPackage"/> -->

<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile" />

<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation" />

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="FileLength" />

<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter" />

<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$" />
<property name="minimum" value="0" />
<property name="maximum" value="2" />
<property name="message" value="Line has trailing spaces." />
</module>

<module name="SuppressionCommentFilter"/>

<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<!-- <module name="Header"> -->
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
<!-- <property name="fileExtensions" value="java"/> -->
<!-- </module> -->

<module name="TreeWalker">

<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!-- <module name="JavadocMethod"/> -->
<!-- <module name="JavadocType"/> -->
<!-- <module name="JavadocVariable"/> -->
<!-- <module name="JavadocStyle"/> -->

<module name="FileContentsHolder"/>
<module name="SuppressWarningsHolder" />


<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName" />
<module name="LocalFinalVariableName" />
<module name="LocalVariableName">
<!-- this must be removed soon... no underscore in variable's name -->
<property name="format" value="^[a-z]([_a-zA-Z0-9]+)*$"/>
</module>
<module name="MemberName">
<!-- this must be removed soon... no underscore in member's name -->
<property name="format" value="^[a-z]([_a-zA-Z0-9]+)*$"/>
</module>
<module name="MethodName">
<!-- we have some undercores in test method names -->
<property name="format" value="^[a-z]([_a-zA-Z0-9]+)*$"/>
</module>
<module name="PackageName" />
<module name="ParameterName">
<!-- this must be removed soon... no underscore in parameters's name -->
<property name="format" value="^[a-z]([_a-zA-Z0-9]+)*$"/>
</module>
<module name="StaticVariableName" >
<property name="format" value="^[a-zA-Z]([_a-zA-Z0-9]+)*$"/>
</module>
<module name="TypeName">
<!-- this must be removed soon... no underscore in type's name -->
<property name="format" value="^[A-Z][_a-zA-Z0-9]*$"/>
</module>




<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport" />
<module name="IllegalImport" /> <!-- defaults to sun.* packages -->
<module name="RedundantImport" />
<module name="UnusedImports">
<property name="processJavadoc" value="true" />
</module>


<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="MethodLength" />
<module name="ParameterNumber" />


<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForIteratorPad" />
<module name="GenericWhitespace" />
<module name="MethodParamPad" />
<module name="NoWhitespaceAfter" />
<module name="NoWhitespaceBefore" />
<module name="OperatorWrap" />
<module name="ParenPad" />
<module name="TypecastParenPad" />
<module name="WhitespaceAfter" />
<module name="WhitespaceAround" />


<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder" />
<module name="RedundantModifier" />


<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks" />
<module name="EmptyBlock" />
<module name="LeftCurly" />
<module name="NeedBraces" />
<module name="RightCurly" />


<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!-- <module name="AvoidInlineConditionals"/> -->
<module name="EmptyStatement" />
<module name="EqualsHashCode" />
<!-- <module name="HiddenField"/> -->
<module name="IllegalInstantiation" />
<module name="InnerAssignment" />
<module name="MagicNumber" />
<module name="MissingSwitchDefault" />

<module name="SimplifyBooleanExpression" />
<module name="SimplifyBooleanReturn" />

<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!-- <module name="DesignForExtension"/> -->
<module name="FinalClass" />
<module name="HideUtilityClassConstructor" />
<!-- <module name="InterfaceIsType"/> -->
<module name="VisibilityModifier">
<property name="packageAllowed" value="true" />
<property name="protectedAllowed" value="true" />
</module>


<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle" />
<!-- <module name="FinalParameters"/> -->
<!-- <module name="TodoComment"/> -->
<module name="UpperEll" />
<module name="Indentation">
<property name="tabWidth" value="4" />
<property name="basicOffset" value="4" />
</module>
</module>


</module>
40 changes: 40 additions & 0 deletions config/quality/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0"?>

<!--
~ The MIT License (MIT)
~
~ Copyright (c) 2015 Piasy
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
-->

<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>
<suppress checks="[a-zA-Z0-9]*" files="R.java" />
<suppress checks="[a-zA-Z0-9]*" files="BuildConfig.java" />
<suppress checks="[a-zA-Z0-9]*" files="Test" />
<suppress checks="[a-zA-Z0-9]*" files="Dagger*" />
<suppress checks="[a-zA-Z0-9]*" files=".*_.*Factory.java" />
<suppress checks="[a-zA-Z0-9]*" files=".*ViewInjector.java" />
<suppress checks="[a-zA-Z0-9]*" files=".*_MembersInjector.java" />

</suppressions>
10 changes: 10 additions & 0 deletions config/quality/findbugs/findbugs-filter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?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>
</FindBugsFilter>
9 changes: 9 additions & 0 deletions config/quality/pmd/pmd-ruleset.xml
Original file line number Diff line number Diff line change
@@ -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>
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Wed Sep 30 10:59:19 CST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
Loading

0 comments on commit c145310

Please sign in to comment.