├── LICENSE.txt ├── README.md ├── android-check-logo.xcf ├── android-check-plugin-example ├── .gitattributes ├── .gitignore ├── app │ ├── build.gradle │ ├── config │ │ └── checkstyle.xml │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ └── logback.xml │ │ ├── java │ │ └── example │ │ │ └── MainActivity.java │ │ └── res │ │ ├── drawable-hdpi │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ │ ├── layout │ │ └── main.xml │ │ └── values │ │ └── strings.xml ├── build.gradle ├── config │ └── pmd.xml ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── libs │ ├── sample-android-library │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── example │ │ │ │ └── AndroidLibrary.java │ │ │ └── res │ │ │ └── values │ │ │ └── strings.xml │ └── sample-java-library │ │ ├── build.gradle │ │ └── src │ │ └── main │ │ └── java │ │ └── example │ │ └── JavaLibrary.java └── settings.gradle └── android-check-plugin ├── .gitignore ├── build.gradle ├── gradle ├── gradle-publish.gradle ├── publish.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main ├── groovy └── com │ └── noveogroup │ └── android │ └── check │ ├── CheckExtension.groovy │ ├── CheckPlugin.groovy │ ├── checkstyle │ ├── CheckstyleCheck.groovy │ └── CheckstyleConfig.groovy │ ├── common │ ├── CommonCheck.groovy │ ├── CommonConfig.groovy │ ├── Severity.groovy │ └── Utils.groovy │ ├── findbugs │ ├── FindbugsCheck.groovy │ └── FindbugsConfig.groovy │ └── pmd │ ├── PmdCheck.groovy │ └── PmdConfig.groovy └── resources ├── META-INF └── gradle-plugins │ └── com.noveogroup.android.check.properties ├── checkstyle ├── checkstyle-easy.xml ├── checkstyle-hard.xml └── checkstyle.xsl ├── findbugs ├── findbugs-easy.xml ├── findbugs-hard.xml └── findbugs.xsl └── pmd ├── pmd-easy.xml ├── pmd-hard.xml └── pmd.xsl /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Noveo Group 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | Except as contained in this notice, the name(s) of the above copyright holders 14 | shall not be used in advertising or otherwise to promote the sale, use or 15 | other dealings in this Software without prior written authorization. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Android Check 2 | ============= 3 | 4 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-android--check-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1530) 5 | 6 | Static code analysis plugin for Android project. 7 | 8 | Usage 9 | ----- 10 | 11 | Modifications in `/build.gradle`: 12 | 13 | ```groovy 14 | buildscript { 15 | repositories { jcenter() } 16 | dependencies { 17 | ... 18 | classpath 'com.noveogroup.android:check:1.2.5' 19 | ... 20 | } 21 | } 22 | ``` 23 | 24 | Modifications in `//build.gradle`: 25 | 26 | ```groovy 27 | apply plugin: 'com.noveogroup.android.check' 28 | ``` 29 | 30 | Configuration 31 | ------------- 32 | 33 | ### Recommended 34 | 35 | Recommended configuration is a default one (empty). 36 | 37 | ```groovy 38 | // no configuration 39 | ``` 40 | 41 | ### Hardcore 42 | 43 | ```groovy 44 | check { 45 | abortOnError true 46 | checkstyle { config hard() } 47 | findbugs { config hard() } 48 | pmd { config hard() } 49 | } 50 | ``` 51 | 52 | ### Skip checking 53 | 54 | ```groovy 55 | check { skip true } 56 | ``` 57 | 58 | Skip Checkstyle only 59 | 60 | ```groovy 61 | check { checkstyle { skip true } } 62 | ``` 63 | 64 | Skip FindBugs only 65 | 66 | ```groovy 67 | check { findbugs { skip true } } 68 | ``` 69 | 70 | Skip PMD only 71 | 72 | ```groovy 73 | check { pmd { skip true } } 74 | ``` 75 | 76 | ### Description 77 | 78 | ```groovy 79 | // configuration is optional 80 | check { 81 | // skip source code checking or not, false by default 82 | skip true/false 83 | // fails build if code style violation is found, false by default 84 | abortOnError true/false 85 | // configuration of Checkstyle checker 86 | checkstyle { 87 | // skip Checkstyle, false by default 88 | skip true/false 89 | 90 | // fails build if Checkstyle rule violation is found, false by default 91 | abortOnError true/false 92 | 93 | // configuration file 94 | config project.file('path/to/checkstyle.xml') 95 | // configuration resource 96 | // see http://gradle.org/docs/2.2/release-notes#sharing-configuration-files-across-builds 97 | config resources.text.fromFile(someTask) 98 | // configuration path 99 | config 'path/to/checkstyle.xml' 100 | // predefined configurations: easy and hard 101 | config easy() 102 | config hard() 103 | // by default plugin finds configuration file in /config/checkstyle.xml, 104 | // after that in /config/checkstyle.xml and if there are no configuration 105 | // file, easy() configuration will be used. 106 | 107 | // directory for report files 108 | report new File(project.buildDir, 'reports/pmd') 109 | // XML report file 110 | reportXML new File(project.buildDir, 'reports/checkstyle/checkstyle.xml') 111 | // HTML report file 112 | reportHTML new File(project.buildDir, 'reports/checkstyle/checkstyle.html') 113 | } 114 | // configuration of FindBugs checker 115 | findbugs { 116 | // the same configuration as for Checkstyle 117 | 118 | // by default plugin finds configuration file in /config/findbugs.xml, 119 | // after that in /config/findbugs.xml and if there are no configuration 120 | // file, easy() configuration will be used. 121 | } 122 | // configuration of PMD checker 123 | pmd { 124 | // the same configuration as for Checkstyle 125 | 126 | // by default plugin finds configuration file in /config/pmd.xml, 127 | // after that in /config/pmd.xml and if there are no configuration 128 | // file, easy() configuration will be used. 129 | } 130 | } 131 | ``` 132 | 133 | Developed By 134 | ============ 135 | 136 | * [Noveo Group][1] 137 | * [Pavel Stepanov](https://github.com/stefan-nsk) 138 | * [Sergey Malichenko](https://github.com/smalichenko) - 139 | 140 | License 141 | ======= 142 | 143 | Copyright (c) 2017 Noveo Group 144 | 145 | Permission is hereby granted, free of charge, to any person obtaining a copy 146 | of this software and associated documentation files (the "Software"), to deal 147 | in the Software without restriction, including without limitation the rights 148 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 149 | copies of the Software, and to permit persons to whom the Software is 150 | furnished to do so, subject to the following conditions: 151 | 152 | The above copyright notice and this permission notice shall be included in 153 | all copies or substantial portions of the Software. 154 | 155 | Except as contained in this notice, the name(s) of the above copyright holders 156 | shall not be used in advertising or otherwise to promote the sale, use or 157 | other dealings in this Software without prior written authorization. 158 | 159 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 160 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 161 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 162 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 163 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 164 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 165 | THE SOFTWARE. 166 | 167 | [1]: http://noveogroup.com/ 168 | -------------------------------------------------------------------------------- /android-check-logo.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noveogroup/android-check/d6d840b57237844a082daf855aed0aa4d48f7c90/android-check-logo.xcf -------------------------------------------------------------------------------- /android-check-plugin-example/.gitattributes: -------------------------------------------------------------------------------- 1 | # Default 2 | * text=auto 3 | 4 | # Andriod 5 | *.gradle text 6 | *.java text 7 | *.properties text 8 | *.xml text 9 | /gradlew text eol=lf 10 | /gradlew.bat text eol=crlf 11 | -------------------------------------------------------------------------------- /android-check-plugin-example/.gitignore: -------------------------------------------------------------------------------- 1 | # Android 2 | local.properties 3 | 4 | # Gradle 5 | .gradle 6 | build 7 | 8 | # IntelliJ Idea 9 | .idea 10 | *.iml 11 | -------------------------------------------------------------------------------- /android-check-plugin-example/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.noveogroup.android.check' 3 | 4 | android { 5 | compileSdkVersion 25 6 | buildToolsVersion '25.0.2' 7 | 8 | defaultConfig { 9 | versionCode 1 10 | versionName '1.0' 11 | minSdkVersion 14 12 | targetSdkVersion 25 13 | } 14 | 15 | compileOptions { 16 | sourceCompatibility JavaVersion.VERSION_1_7 17 | targetCompatibility JavaVersion.VERSION_1_7 18 | } 19 | 20 | lintOptions { abortOnError false } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(dir: rootProject.file('libs'), include: ['*.jar']) 25 | compile fileTree(dir: project.file('libs'), include: ['*.jar']) 26 | compile project(':libs:sample-android-library') 27 | compile project(':libs:sample-java-library') 28 | compile 'org.slf4j:slf4j-api:1.7.21' 29 | compile 'com.github.tony19:logback-android-core:1.1.1-6' 30 | compile('com.github.tony19:logback-android-classic:1.1.1-6') { 31 | // workaround issue #73 32 | exclude group: 'com.google.android', module: 'android' 33 | } 34 | } 35 | 36 | check { 37 | abortOnError false 38 | 39 | checkstyle { 40 | abortOnError false 41 | } 42 | 43 | findbugs { 44 | abortOnError false 45 | config hard() 46 | reportXML new File(project.buildDir, 'reports/findbugs/findbugs.xml') 47 | } 48 | 49 | pmd { 50 | abortOnError false 51 | report new File(project.buildDir, 'reports/pmd') 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /android-check-plugin-example/app/config/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /android-check-plugin-example/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /android-check-plugin-example/app/src/main/assets/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %logger{12} 5 | 6 | 7 | [%-20thread] %msg 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /android-check-plugin-example/app/src/main/java/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | import my.example.R; 10 | 11 | public class MainActivity extends Activity { 12 | 13 | private static final Logger LOGGER = LoggerFactory.getLogger(MainActivity.class); 14 | 15 | // CR Code Review 16 | 17 | // TODO To Do 18 | 19 | @Override 20 | public void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.main); 23 | LOGGER.info("MainActivity::onCreate"); 24 | LOGGER.info("AndroidLibrary.process: {}", AndroidLibrary.process(this)); 25 | LOGGER.info("JavaLibrary.process: {}", JavaLibrary.process(this)); 26 | 27 | new Thread() { 28 | @Override 29 | public void run() { 30 | try { 31 | Object object = ""; 32 | Double value = (Double) object; 33 | } catch (Exception e) { 34 | 35 | } 36 | 37 | "".length(); 38 | } 39 | }.start(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /android-check-plugin-example/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noveogroup/android-check/d6d840b57237844a082daf855aed0aa4d48f7c90/android-check-plugin-example/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android-check-plugin-example/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noveogroup/android-check/d6d840b57237844a082daf855aed0aa4d48f7c90/android-check-plugin-example/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android-check-plugin-example/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noveogroup/android-check/d6d840b57237844a082daf855aed0aa4d48f7c90/android-check-plugin-example/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android-check-plugin-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noveogroup/android-check/d6d840b57237844a082daf855aed0aa4d48f7c90/android-check-plugin-example/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android-check-plugin-example/app/src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /android-check-plugin-example/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Example 5 | Hello, world! 6 | 7 | -------------------------------------------------------------------------------- /android-check-plugin-example/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { jcenter(); mavenLocal() } 3 | dependencies { 4 | classpath 'com.android.tools.build:gradle:2.3.1' 5 | classpath 'com.noveogroup.android:check:1.2.4' 6 | } 7 | } 8 | 9 | allprojects { 10 | repositories { jcenter(); mavenLocal() } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /android-check-plugin-example/config/pmd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | POM rule set file 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /android-check-plugin-example/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noveogroup/android-check/d6d840b57237844a082daf855aed0aa4d48f7c90/android-check-plugin-example/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android-check-plugin-example/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 6 | -------------------------------------------------------------------------------- /android-check-plugin-example/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /android-check-plugin-example/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android-check-plugin-example/libs/sample-android-library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion '25.0.2' 6 | 7 | defaultConfig { 8 | versionCode 1 9 | versionName '1.0' 10 | minSdkVersion 14 11 | targetSdkVersion 25 12 | } 13 | 14 | compileOptions { 15 | sourceCompatibility JavaVersion.VERSION_1_7 16 | targetCompatibility JavaVersion.VERSION_1_7 17 | } 18 | 19 | lintOptions { 20 | abortOnError false 21 | checkAllWarnings true 22 | // there will be a lot of useless lint warnings if delete this line 23 | disable 'AllowBackup' 24 | // for most projects accessibility tools support is out of scope 25 | disable 'ContentDescription' 26 | // a lot of Java libraries have references to Java SE packages 27 | disable 'InvalidPackage' 28 | // sp can be scaled by the user's font size preference so can break design 29 | disable 'SpUsage' 30 | // there are no pixel art for the most projects 31 | disable 'IconMissingDensityFolder' 32 | // it is just reminder 33 | disable 'SelectableText' 34 | // there are too few projects with RTL support 35 | disable 'RtlCompat', 'RtlEnabled', 'RtlHardcoded', 'RtlSymmetry' 36 | } 37 | } 38 | 39 | dependencies { 40 | compile fileTree(dir: rootProject.file('libs'), include: ['*.jar']) 41 | compile fileTree(dir: project.file('libs'), include: ['*.jar']) 42 | compile 'com.android.support:recyclerview-v7:25.3.1' 43 | } 44 | -------------------------------------------------------------------------------- /android-check-plugin-example/libs/sample-android-library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /android-check-plugin-example/libs/sample-android-library/src/main/java/example/AndroidLibrary.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | import android.content.Context; 4 | 5 | import example.library.R; 6 | 7 | public final class AndroidLibrary { 8 | 9 | private AndroidLibrary() { 10 | throw new UnsupportedOperationException(); 11 | } 12 | 13 | public static String process(Context context) { 14 | return context.getString(R.string.sample_value); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /android-check-plugin-example/libs/sample-android-library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Sample Value 6 | 7 | 8 | -------------------------------------------------------------------------------- /android-check-plugin-example/libs/sample-java-library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | 3 | sourceCompatibility = JavaVersion.VERSION_1_7 4 | targetCompatibility = JavaVersion.VERSION_1_7 5 | 6 | dependencies { 7 | compile 'com.google.android:android:4.0.1.2' 8 | } 9 | -------------------------------------------------------------------------------- /android-check-plugin-example/libs/sample-java-library/src/main/java/example/JavaLibrary.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | import android.content.Context; 4 | 5 | public final class JavaLibrary { 6 | 7 | private JavaLibrary() { 8 | throw new UnsupportedOperationException(); 9 | } 10 | 11 | public static String process(Context context) { 12 | return context.getPackageName(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /android-check-plugin-example/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':libs:sample-android-library' 2 | include ':libs:sample-java-library' 3 | include ':app' 4 | -------------------------------------------------------------------------------- /android-check-plugin/.gitignore: -------------------------------------------------------------------------------- 1 | # Android 2 | local.properties 3 | 4 | # Gradle 5 | .gradle 6 | build 7 | 8 | # IntelliJ Idea 9 | .idea 10 | *.iml 11 | -------------------------------------------------------------------------------- /android-check-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'groovy' 2 | 3 | repositories { jcenter() } 4 | 5 | dependencies { 6 | compile gradleApi() 7 | 8 | // Checkstyle 9 | // Android Lint depends on guava 17.0 10 | compile('com.puppycrawl.tools:checkstyle:7.6.1') { 11 | exclude module: 'guava' 12 | } 13 | 14 | // FindBugs 15 | compile 'com.google.code.findbugs:findbugs:3.0.1' 16 | 17 | // PMD 18 | compile 'net.sourceforge.pmd:pmd-java:5.5.5' 19 | } 20 | 21 | group = 'com.noveogroup.android' 22 | version = '1.2.5' 23 | description = 'Static code analysis plugin for Android project.' 24 | 25 | task wrapper(type: Wrapper) { 26 | group 'Build Setup' 27 | description 'Initializes Gradle Wrapper.' 28 | gradleVersion = '3.3' 29 | } 30 | 31 | project.ext { 32 | plugin = 'com.noveogroup.android.check' 33 | name = 'Android Check Plugin' 34 | website = 'https://github.com/noveogroup/android-check' 35 | scm = 'https://github.com/noveogroup/android-check' 36 | pom = { 37 | licenses { 38 | license { 39 | name 'The MIT License (MIT)' 40 | url 'http://opensource.org/licenses/MIT' 41 | distribution 'repo' 42 | } 43 | } 44 | scm { 45 | url project.ext.scm 46 | connection 'scm:git@github.com:noveogroup/android-check.git' 47 | developerConnection 'scm:git@github.com:noveogroup/android-check.git' 48 | } 49 | issueManagement { 50 | system 'GitHub' 51 | url 'https://github.com/noveogroup/android-check/issues' 52 | } 53 | developers { 54 | developer { 55 | name 'Pavel Stepanov' 56 | url 'https://github.com/stefan-nsk' 57 | roles { 58 | role 'architect' 59 | role 'developer' 60 | } 61 | } 62 | developer { 63 | name 'Sergey Malichenko' 64 | url 'https://github.com/smalichenko' 65 | roles { 66 | role 'developer' 67 | } 68 | } 69 | } 70 | } 71 | bintray = { 72 | user = project.hasProperty('bintray.user') ? project['bintray.user'] : 'anonymous' 73 | key = project.hasProperty('bintray.key') ? project['bintray.key'] : 'api-key' 74 | repo = 'android-check' 75 | tags = ['android', 'plugin', 'check'] 76 | licenses = ['MIT'] 77 | issueTracker = 'https://github.com/noveogroup/android-check/issues' 78 | vcs = 'https://github.com/noveogroup/android-check' 79 | dryRun = false // whether to run this as dry-run, without deploying 80 | publish = false // if version should be auto published after an upload 81 | } 82 | } 83 | 84 | apply from: rootProject.file('gradle/gradle-publish.gradle') 85 | apply from: rootProject.file('gradle/publish.gradle') 86 | -------------------------------------------------------------------------------- /android-check-plugin/gradle/gradle-publish.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { url 'https://plugins.gradle.org/m2/' } 4 | } 5 | dependencies { 6 | classpath 'com.gradle.publish:plugin-publish-plugin:0.9.7' 7 | } 8 | } 9 | 10 | // hack: plugin 'com.gradle.plugin-publish' is not visible by name 11 | apply plugin: com.gradle.publish.PublishPlugin 12 | // hack: without it bintray property is not visible 13 | logger.debug("$project.ext.bintray") 14 | 15 | pluginBundle { 16 | website = project.ext.website 17 | vcsUrl = project.ext.scm 18 | description = project.description 19 | 20 | plugins { 21 | checkPlugin { 22 | id = project.ext.plugin 23 | displayName = project.ext.name 24 | tags = project.ext.bintray.tags 25 | version = project.version 26 | } 27 | } 28 | mavenCoordinates { 29 | groupId = project.group 30 | artifactId = project.name 31 | version = project.version 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android-check-plugin/gradle/publish.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven-publish' 2 | 3 | task('groovydocJar', type: Jar, dependsOn: groovydoc) { 4 | group 'documentation' 5 | description 'Assembles a jar archive containing Groovydoc API documentation.' 6 | classifier = 'groovydoc' 7 | from javadoc.destinationDir 8 | } 9 | 10 | task('sourcesJar', type: Jar) { 11 | group 'documentation' 12 | description 'Assembles a jar archive containing the main source code.' 13 | classifier = 'sources' 14 | from sourceSets.main.allSource 15 | } 16 | 17 | publishing { 18 | publications { 19 | maven(MavenPublication) { 20 | from components.java 21 | artifact groovydocJar 22 | artifact sourcesJar 23 | 24 | pom.withXml { 25 | asNode().appendNode('name', project.ext.name) 26 | asNode().appendNode('description', project.description) 27 | asNode().appendNode('url', project.ext.website) 28 | asNode().children().last() + project.ext.pom 29 | } 30 | } 31 | } 32 | } 33 | 34 | buildscript { 35 | repositories { jcenter() } 36 | dependencies { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' } 37 | } 38 | // hack: plugin 'com.jfrog.bintray' is not visible by name 39 | apply plugin: com.jfrog.bintray.gradle.BintrayPlugin 40 | // hack: without it bintray property is not visible 41 | logger.debug("$project.ext.bintray") 42 | 43 | bintray { 44 | user = project.ext.bintray.user 45 | key = project.ext.bintray.key 46 | publications = ['maven'] 47 | dryRun = project.ext.bintray.dryRun 48 | publish = project.ext.bintray.publish 49 | pkg { 50 | repo = project.ext.bintray.repo 51 | name = project.name 52 | desc = project.description 53 | websiteUrl = project.ext.website 54 | issueTrackerUrl = project.ext.issueTracker 55 | vcsUrl = project.ext.vcs 56 | licenses = project.ext.bintray.licenses 57 | labels = project.ext.bintray.tags 58 | publicDownloadNumbers = true 59 | version { 60 | name = project.version 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /android-check-plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/noveogroup/android-check/d6d840b57237844a082daf855aed0aa4d48f7c90/android-check-plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android-check-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 6 | -------------------------------------------------------------------------------- /android-check-plugin/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /android-check-plugin/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android-check-plugin/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'check' 2 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/CheckExtension.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check 28 | 29 | import com.noveogroup.android.check.checkstyle.CheckstyleConfig 30 | import com.noveogroup.android.check.findbugs.FindbugsConfig 31 | import com.noveogroup.android.check.pmd.PmdConfig 32 | import org.gradle.api.Action 33 | import org.gradle.api.Project 34 | 35 | class CheckExtension { 36 | 37 | static final String NAME = 'check' 38 | 39 | private final Project project 40 | 41 | CheckstyleConfig checkstyle 42 | 43 | void checkstyle(Action action) { action.execute(checkstyle) } 44 | 45 | FindbugsConfig findbugs 46 | 47 | void findbugs(Action action) { action.execute(findbugs) } 48 | 49 | PmdConfig pmd 50 | 51 | void pmd(Action action) { action.execute(pmd) } 52 | 53 | CheckExtension(Project project) { 54 | this.project = project 55 | this.checkstyle = new CheckstyleConfig(project) 56 | this.findbugs = new FindbugsConfig(project) 57 | this.pmd = new PmdConfig(project) 58 | } 59 | 60 | boolean skip = false 61 | 62 | void skip(boolean skip) { this.skip = skip } 63 | 64 | boolean abortOnError = false 65 | 66 | void abortOnError(boolean abortOnError) { this.abortOnError = abortOnError } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/CheckPlugin.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check 28 | 29 | import com.noveogroup.android.check.checkstyle.CheckstyleCheck 30 | import com.noveogroup.android.check.findbugs.FindbugsCheck 31 | import com.noveogroup.android.check.pmd.PmdCheck 32 | import org.gradle.api.Plugin 33 | import org.gradle.api.Project 34 | 35 | class CheckPlugin implements Plugin { 36 | 37 | @Override 38 | void apply(Project target) { 39 | target.extensions.create(CheckExtension.NAME, CheckExtension, target) 40 | 41 | new CheckstyleCheck().apply(target) 42 | new FindbugsCheck().apply(target) 43 | new PmdCheck().apply(target) 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/checkstyle/CheckstyleCheck.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.checkstyle 28 | 29 | import com.noveogroup.android.check.CheckExtension 30 | import com.noveogroup.android.check.common.CommonCheck 31 | import com.noveogroup.android.check.common.CommonConfig 32 | import com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask 33 | import com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.Formatter 34 | import com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.FormatterType 35 | import groovy.util.slurpersupport.GPathResult 36 | import org.gradle.api.Project 37 | 38 | class CheckstyleCheck extends CommonCheck { 39 | 40 | CheckstyleCheck() { super('checkstyle', 'androidCheckstyle', 'Runs Android Checkstyle') } 41 | 42 | @Override 43 | protected CommonConfig getConfig(CheckExtension extension) { return extension.checkstyle } 44 | 45 | @Override 46 | protected void performCheck(Project project, List sources, 47 | File configFile, File xmlReportFile) { 48 | CheckstyleAntTask checkStyleTask = new CheckstyleAntTask() 49 | 50 | checkStyleTask.project = project.ant.antProject 51 | checkStyleTask.configURL = configFile.toURI().toURL() 52 | checkStyleTask.addFormatter(new Formatter(type: new FormatterType(value: 'xml'), tofile: xmlReportFile)) 53 | 54 | checkStyleTask.failOnViolation = false 55 | 56 | sources.findAll { it.exists() }.each { 57 | checkStyleTask.addFileset(project.ant.fileset(dir: it)) 58 | } 59 | 60 | checkStyleTask.perform() 61 | } 62 | 63 | @Override 64 | protected int getErrorCount(File xmlReportFile) { 65 | GPathResult xml = new XmlSlurper().parseText(xmlReportFile.text) 66 | return xml.file.inject(0) { count, file -> count + file.error.size() } 67 | } 68 | 69 | @Override 70 | protected String getErrorMessage(int errorCount, File htmlReportFile) { 71 | return "$errorCount Checkstyle rule violations were found. See the report at: ${htmlReportFile.toURI()}" 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/checkstyle/CheckstyleConfig.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.checkstyle 28 | 29 | import com.noveogroup.android.check.common.CommonConfig 30 | import org.gradle.api.Project 31 | 32 | class CheckstyleConfig extends CommonConfig { 33 | 34 | CheckstyleConfig(Project project) { super(project) } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonCheck.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.common 28 | 29 | import com.noveogroup.android.check.CheckExtension 30 | import org.gradle.api.GradleException 31 | import org.gradle.api.Project 32 | 33 | abstract class CommonCheck { 34 | 35 | final String taskCode 36 | final String taskName 37 | final String taskDescription 38 | 39 | CommonCheck(String taskCode, String taskName, String taskDescription) { 40 | this.taskCode = taskCode 41 | this.taskName = taskName 42 | this.taskDescription = taskDescription 43 | } 44 | 45 | protected Set getDependencies() { [] } 46 | 47 | protected abstract Config getConfig(CheckExtension extension) 48 | 49 | protected abstract void performCheck(Project project, List sources, 50 | File configFile, File xmlReportFile) 51 | 52 | protected abstract int getErrorCount(File xmlReportFile) 53 | 54 | protected abstract String getErrorMessage(int errorCount, File htmlReportFile) 55 | 56 | protected void reformatReport(Project project, File styleFile, 57 | File xmlReportFile, File htmlReportFile) { 58 | project.ant.xslt(in: xmlReportFile, out: htmlReportFile) { 59 | style { string(styleFile.text) } 60 | } 61 | } 62 | 63 | void apply(Project target) { 64 | target.task( 65 | [group : 'verification', 66 | description: taskDescription], 67 | taskName) { 68 | doLast { 69 | CheckExtension extension = target.extensions.findByType(CheckExtension) 70 | Config config = getConfig(extension) 71 | 72 | boolean skip = config.resolveSkip(extension.skip) 73 | boolean abortOnError = config.resolveAbortOnError(extension.abortOnError) 74 | File configFile = config.resolveConfigFile(taskCode) 75 | File styleFile = config.resolveStyleFile(taskCode) 76 | File xmlReportFile = config.resolveXmlReportFile(taskCode) 77 | File htmlReportFile = config.resolveHtmlReportFile(taskCode) 78 | List sources = config.getAndroidSources() 79 | 80 | if (skip) { 81 | target.logger.warn "skip $taskName" 82 | } else { 83 | xmlReportFile.parentFile.mkdirs() 84 | performCheck(target, sources, configFile, xmlReportFile) 85 | htmlReportFile.parentFile.mkdirs() 86 | reformatReport(target, styleFile, xmlReportFile, htmlReportFile) 87 | 88 | int errorCount = getErrorCount(xmlReportFile) 89 | if (errorCount) { 90 | String errorMessage = getErrorMessage(errorCount, htmlReportFile) 91 | if (abortOnError) { 92 | throw new GradleException(errorMessage) 93 | } else { 94 | target.logger.warn errorMessage 95 | } 96 | } 97 | } 98 | } 99 | } 100 | 101 | target.tasks.getByName('check').dependsOn taskName 102 | dependencies.each { target.tasks.getByName(taskName).dependsOn it } 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonConfig.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.common 28 | 29 | import org.gradle.api.Project 30 | import org.gradle.api.resources.TextResource 31 | 32 | class CommonConfig { 33 | 34 | protected final Project project 35 | 36 | CommonConfig(Project project) { 37 | this.project = project 38 | } 39 | 40 | Boolean skip = null 41 | 42 | void skip(boolean skip) { this.skip = skip } 43 | 44 | Boolean abortOnError = null 45 | 46 | void abortOnError(boolean abortOnError) { this.abortOnError = abortOnError } 47 | 48 | private TextResource configResource = null 49 | private File configFile = null 50 | private Severity configSeverity = null 51 | 52 | private void checkConfigDefined() { 53 | if (configResource || configFile || configSeverity) { 54 | throw new IllegalArgumentException('configuration XML is already defined') 55 | } 56 | } 57 | 58 | void config(TextResource resource) { 59 | checkConfigDefined() 60 | this.configResource = resource 61 | } 62 | 63 | void config(File file) { 64 | checkConfigDefined() 65 | this.configFile = file 66 | } 67 | 68 | void config(String path) { 69 | config(project.file(path)) 70 | } 71 | 72 | Severity easy() { Severity.EASY } 73 | 74 | Severity hard() { Severity.HARD } 75 | 76 | void config(Severity severity) { 77 | checkConfigDefined() 78 | this.configSeverity = severity 79 | } 80 | 81 | File reportDirectory 82 | File reportXML 83 | File reportHTML 84 | 85 | void report(File reportDirectory) { 86 | this.reportDirectory = reportDirectory 87 | } 88 | 89 | void reportXML(File reportXML) { 90 | this.reportXML = reportXML 91 | } 92 | 93 | void reportHTML(File reportHTML) { 94 | this.reportHTML = reportHTML 95 | } 96 | 97 | boolean resolveSkip(boolean defaultSkip) { 98 | return skip == null ? defaultSkip : skip 99 | } 100 | 101 | boolean resolveAbortOnError(boolean defaultAbortOnError) { 102 | return abortOnError == null ? defaultAbortOnError : abortOnError 103 | } 104 | 105 | private String resolveConfig(String code) { 106 | if (configResource) { 107 | return configResource.asString() 108 | } 109 | if (configFile) { 110 | return configFile.text 111 | } 112 | if (configSeverity) { 113 | return Utils.getResource(project, "$code/$code-${configSeverity.suffix}.xml") 114 | } 115 | 116 | File file = project.file("config/${code}.xml") 117 | if (file.exists()) { 118 | return file.text 119 | } 120 | 121 | File rootFile = project.rootProject.file("config/${code}.xml") 122 | if (rootFile.exists()) { 123 | return rootFile.text 124 | } 125 | 126 | return Utils.getResource(project, "$code/$code-${Severity.EASY.suffix}.xml") 127 | } 128 | 129 | File resolveConfigFile(String code) { 130 | File file = new File(project.buildDir, "tmp/android-check/${code}.xml") 131 | file.parentFile.mkdirs() 132 | file.delete() 133 | file << resolveConfig(code) 134 | return file 135 | } 136 | 137 | private String resolveStyle(String code) { 138 | return Utils.getResource(project, "$code/${code}.xsl") 139 | } 140 | 141 | File resolveStyleFile(String code) { 142 | File file = new File(project.buildDir, "tmp/android-check/${code}.xsl") 143 | file.parentFile.mkdirs() 144 | file.delete() 145 | file << resolveStyle(code) 146 | return file 147 | } 148 | 149 | private File resolveReportFile(String extension, File reportFile, File reportDirectory, String code) { 150 | if (reportFile) { 151 | return reportFile 152 | } 153 | 154 | if (reportDirectory) { 155 | return new File(reportDirectory, "${code}.${extension}") 156 | } 157 | 158 | return new File(project.buildDir, "outputs/${code}/${code}.${extension}") 159 | } 160 | 161 | File resolveXmlReportFile(String code) { 162 | return resolveReportFile('xml', reportXML, reportDirectory, code) 163 | } 164 | 165 | File resolveHtmlReportFile(String code) { 166 | return resolveReportFile('html', reportHTML, reportDirectory, code) 167 | } 168 | 169 | List getAndroidSources() { 170 | return Utils.getAndroidSources(project) 171 | } 172 | 173 | } 174 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/Severity.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.common; 28 | 29 | enum Severity { 30 | 31 | EASY('easy'), HARD('hard') 32 | 33 | private final String suffix 34 | 35 | private Severity(String suffix) { this.suffix = suffix } 36 | 37 | String getSuffix() { return suffix } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/Utils.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.common 28 | 29 | import org.gradle.api.Project 30 | 31 | import java.util.jar.JarEntry 32 | import java.util.jar.JarFile 33 | 34 | final class Utils { 35 | 36 | private Utils() { throw new UnsupportedOperationException() } 37 | 38 | static String getResource(Project project, String resourcePath) { 39 | Set files = new HashSet<>() 40 | files += project.buildscript.configurations.classpath.resolve() 41 | files += project.rootProject.buildscript.configurations.classpath.resolve() 42 | File file = files.find { new JarFile(it).getJarEntry(resourcePath) } 43 | if (file == null) { 44 | return null 45 | } else { 46 | JarFile jarFile = new JarFile(file) 47 | JarEntry jarEntry = jarFile.getJarEntry(resourcePath) 48 | return jarFile.getInputStream(jarEntry).text 49 | } 50 | } 51 | 52 | static List getAndroidSources(Project project) { 53 | project.android.sourceSets.inject([]) { 54 | dirs, sourceSet -> dirs + sourceSet.java.srcDirs 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/findbugs/FindbugsCheck.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.findbugs 28 | 29 | import com.noveogroup.android.check.CheckExtension 30 | import com.noveogroup.android.check.common.CommonCheck 31 | import com.noveogroup.android.check.common.CommonConfig 32 | import edu.umd.cs.findbugs.anttask.FindBugsTask 33 | import groovy.util.slurpersupport.GPathResult 34 | import org.apache.tools.ant.types.FileSet 35 | import org.apache.tools.ant.types.Path 36 | import org.gradle.api.Project 37 | 38 | class FindbugsCheck extends CommonCheck { 39 | 40 | FindbugsCheck() { super('findbugs', 'androidFindbugs', 'Runs Android FindBugs') } 41 | 42 | @Override 43 | protected Set getDependencies() { ['assemble'] } 44 | 45 | @Override 46 | protected CommonConfig getConfig(CheckExtension extension) { return extension.findbugs } 47 | 48 | @Override 49 | protected void performCheck(Project project, List sources, 50 | File configFile, File xmlReportFile) { 51 | 52 | FindBugsTask findBugsTask = new FindBugsTask() 53 | 54 | findBugsTask.project = project.ant.antProject 55 | findBugsTask.workHard = true 56 | findBugsTask.excludeFilter = configFile 57 | findBugsTask.output = "xml:withMessages" 58 | findBugsTask.outputFile = xmlReportFile 59 | findBugsTask.failOnError = false 60 | 61 | Path sourcePath = findBugsTask.createSourcePath() 62 | sources.findAll { it.exists() }.each { 63 | sourcePath.addFileset(project.ant.fileset(dir: it)) 64 | } 65 | 66 | Path classpath = findBugsTask.createClasspath() 67 | project.rootProject.buildscript.configurations.classpath.resolve().each { 68 | classpath.createPathElement().location = it 69 | } 70 | project.buildscript.configurations.classpath.resolve().each { 71 | classpath.createPathElement().location = it 72 | } 73 | 74 | Set includes = [] 75 | sources.findAll { it.exists() }.each { File directory -> 76 | FileSet fileSet = project.ant.fileset(dir: directory) 77 | Path path = project.ant.path() 78 | path.addFileset(fileSet) 79 | 80 | path.each { 81 | String includePath = new File(it.toString()).absolutePath - directory.absolutePath 82 | includes.add("**${includePath.replaceAll('\\.java$', '')}*") 83 | } 84 | } 85 | 86 | findBugsTask.addFileset(project.ant.fileset(dir: project.buildDir, includes: includes.join(','))) 87 | 88 | findBugsTask.perform() 89 | } 90 | 91 | @Override 92 | protected int getErrorCount(File xmlReportFile) { 93 | GPathResult xml = new XmlSlurper().parseText(xmlReportFile.text) 94 | return xml.FindBugsSummary.getProperty('@total_bugs').text() as int 95 | } 96 | 97 | @Override 98 | protected String getErrorMessage(int errorCount, File htmlReportFile) { 99 | return "$errorCount FindBugs rule violations were found. See the report at: ${htmlReportFile.toURI()}" 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/findbugs/FindbugsConfig.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.findbugs 28 | 29 | import com.noveogroup.android.check.common.CommonConfig 30 | import org.gradle.api.Project 31 | 32 | class FindbugsConfig extends CommonConfig { 33 | 34 | FindbugsConfig(Project project) { super(project) } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/pmd/PmdCheck.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.pmd 28 | 29 | import com.noveogroup.android.check.CheckExtension 30 | import com.noveogroup.android.check.common.CommonCheck 31 | import com.noveogroup.android.check.common.CommonConfig 32 | import groovy.util.slurpersupport.GPathResult 33 | import net.sourceforge.pmd.ant.Formatter 34 | import net.sourceforge.pmd.ant.PMDTask 35 | import org.gradle.api.Project 36 | 37 | class PmdCheck extends CommonCheck { 38 | 39 | PmdCheck() { super('pmd', 'androidPmd', 'Runs Android PMD') } 40 | 41 | @Override 42 | protected CommonConfig getConfig(CheckExtension extension) { return extension.pmd } 43 | 44 | @Override 45 | protected void performCheck(Project project, List sources, 46 | File configFile, File xmlReportFile) { 47 | PMDTask pmdTask = new PMDTask() 48 | 49 | pmdTask.project = project.ant.antProject 50 | pmdTask.ruleSetFiles = configFile.toString() 51 | pmdTask.addFormatter(new Formatter(type: 'xml', toFile: xmlReportFile)) 52 | 53 | pmdTask.failOnError = false 54 | pmdTask.failOnRuleViolation = false 55 | 56 | sources.findAll { it.exists() }.each { 57 | pmdTask.addFileset(project.ant.fileset(dir: it)) 58 | } 59 | 60 | pmdTask.perform() 61 | } 62 | 63 | @Override 64 | protected int getErrorCount(File xmlReportFile) { 65 | GPathResult xml = new XmlSlurper().parseText(xmlReportFile.text) 66 | return xml.file.inject(0) { count, file -> count + file.violation.size() } 67 | } 68 | 69 | @Override 70 | protected String getErrorMessage(int errorCount, File htmlReportFile) { 71 | return "$errorCount PMD rule violations were found. See the report at: ${htmlReportFile.toURI()}" 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/groovy/com/noveogroup/android/check/pmd/PmdConfig.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Noveo Group 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * Except as contained in this notice, the name(s) of the above copyright holders 15 | * shall not be used in advertising or otherwise to promote the sale, use or 16 | * other dealings in this Software without prior written authorization. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | package com.noveogroup.android.check.pmd 28 | 29 | import com.noveogroup.android.check.common.CommonConfig 30 | import org.gradle.api.Project 31 | 32 | class PmdConfig extends CommonConfig { 33 | 34 | PmdConfig(Project project) { super(project) } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/META-INF/gradle-plugins/com.noveogroup.android.check.properties: -------------------------------------------------------------------------------- 1 | implementation-class=com.noveogroup.android.check.CheckPlugin 2 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/checkstyle/checkstyle-easy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/checkstyle/checkstyle-hard.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/checkstyle/checkstyle.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | CheckStyle Audit 14 | 50 | 51 | 52 |
53 | 54 | 55 | 56 |
57 | 58 | 59 | 60 |
61 | 62 | 64 | 65 |
66 | 67 | 68 |
69 | 70 | 71 |

Files

72 | 73 | 74 | 75 | 76 | 77 | 79 | 81 | 82 | 83 | 84 | 89 | 92 | 93 | 94 |
NameErrors
85 | 86 | 87 | 88 | 90 | 91 |
95 |
96 | 97 | 98 | 99 |

File

100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 112 | 115 | 116 | 117 |
Error DescriptionLine
110 | 111 | 113 | 114 |
118 |
119 | 120 | 121 |

Summary

122 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 135 | 138 | 139 |
FilesErrors
133 | 134 | 136 | 137 |
140 |
141 | 142 | 143 | 144 | a 145 | b 146 | 147 | 148 | 149 |
150 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/findbugs/findbugs-easy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/findbugs/findbugs-hard.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/findbugs/findbugs.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | FindBugs Audit 12 | 48 | 49 | 50 |
51 | 52 | 53 | 54 |
55 | 56 | 57 | 58 |
59 | 60 | 61 | 62 |
63 | 64 | 65 |
66 | 67 | 68 |

Files

69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 83 | 86 | 87 | 88 |
NameErrors
79 | 80 | 81 | 82 | 84 | 85 |
89 |
90 | 91 | 92 | 93 |
94 |

95 | File 96 | 97 |

98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 114 | 119 | 120 | 121 |
Error DescriptionLine
108 | 109 | 110 | 111 |
112 | 113 |
115 | 116 | - 117 | 118 |
122 | 123 | 124 | 125 |

Summary

126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 138 | 141 | 142 |
FilesErrors
136 | 137 | 139 | 140 |
143 |
144 | 145 | 146 | 147 | a 148 | b 149 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/pmd/pmd-easy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | 12 | POM rule set file 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/pmd/pmd-hard.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | 12 | POM rule set file 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /android-check-plugin/src/main/resources/pmd/pmd.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | PMD Audit 14 | 50 | 51 | 52 |
53 | 54 | 55 | 56 |
57 | 58 | 59 | 60 |
61 | 62 | 64 | 65 |
66 | 67 | 68 |
69 | 70 | 71 |

Files

72 | 73 | 74 | 75 | 76 | 77 | 79 | 81 | 82 | 83 | 84 | 89 | 92 | 93 | 94 |
NameViolations
85 | 86 | 87 | 88 | 90 | 91 |
95 |
96 | 97 | 98 |
99 |

File

100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 117 | 122 | 123 | 124 |
Violation DescriptionLocation
110 | 111 | 112 | 113 | 114 | 115 | 116 | 118 | : 119 | - 120 | : 121 |
125 | 126 | 127 | 128 |

Summary

129 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 142 | 145 | 146 |
FilesViolations
140 | 141 | 143 | 144 |
147 |
148 | 149 | 150 | 151 | a 152 | b 153 | 154 | 155 | 156 | 157 | --------------------------------------------------------------------------------