diff --git a/android-check-plugin/build.gradle b/android-check-plugin/build.gradle index 47ea37e..9e25ed2 100644 --- a/android-check-plugin/build.gradle +++ b/android-check-plugin/build.gradle @@ -19,7 +19,7 @@ dependencies { } group = 'com.noveogroup.android' -version = '1.2.3' +version = '1.3.0-SNAPSHOT' description = 'Static code analysis plugin for Android project.' task wrapper(type: Wrapper) { diff --git a/android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonCheck.groovy b/android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonCheck.groovy index 4784666..2c179c0 100644 --- a/android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonCheck.groovy +++ b/android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonCheck.groovy @@ -60,6 +60,16 @@ abstract class CommonCheck { } } + protected void reformatReport(Project project, File styleFile, + File xmlReportFile) { + def temp = File.createTempFile('android-check', '.txt') + project.ant.xslt(in: xmlReportFile, out: temp) { + style { string(styleFile.text) } + } + System.out << temp.text + System.out.flush() + } + void apply(Project target) { target.task( [group : 'verification', @@ -72,6 +82,7 @@ abstract class CommonCheck { boolean abortOnError = config.resolveAbortOnError(extension.abortOnError) File configFile = config.resolveConfigFile(taskCode) File styleFile = config.resolveStyleFile(taskCode) + File stdoutStyleFile = config.resolveStdoutStyleFile(taskCode) File xmlReportFile = config.resolveXmlReportFile(taskCode) File htmlReportFile = config.resolveHtmlReportFile(taskCode) List sources = config.getAndroidSources() @@ -83,6 +94,7 @@ abstract class CommonCheck { performCheck(target, sources, configFile, xmlReportFile) htmlReportFile.parentFile.mkdirs() reformatReport(target, styleFile, xmlReportFile, htmlReportFile) + reformatReport(target, stdoutStyleFile, xmlReportFile) int errorCount = getErrorCount(xmlReportFile) if (errorCount) { diff --git a/android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonConfig.groovy b/android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonConfig.groovy index 86acc0d..03ccca5 100644 --- a/android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonConfig.groovy +++ b/android-check-plugin/src/main/groovy/com/noveogroup/android/check/common/CommonConfig.groovy @@ -138,6 +138,10 @@ class CommonConfig { return Utils.getResource(project, "$code/${code}.xsl") } + private String resolveStdoutStyle(String code) { + return Utils.getResource(project, "$code/${code}.stdout.xsl") + } + File resolveStyleFile(String code) { File file = new File(project.buildDir, "tmp/android-check/${code}.xsl") file.parentFile.mkdirs() @@ -146,6 +150,14 @@ class CommonConfig { return file } + File resolveStdoutStyleFile(String code) { + File file = new File(project.buildDir, "tmp/android-check/${code}.stdout.xsl") + file.parentFile.mkdirs() + file.delete() + file << resolveStdoutStyle(code) + return file + } + private File resolveReportFile(String extension, File reportFile, File reportDirectory, String code) { if (reportFile) { return reportFile diff --git a/android-check-plugin/src/main/resources/checkstyle/checkstyle.stdout.xsl b/android-check-plugin/src/main/resources/checkstyle/checkstyle.stdout.xsl new file mode 100644 index 0000000..b2293e1 --- /dev/null +++ b/android-check-plugin/src/main/resources/checkstyle/checkstyle.stdout.xsl @@ -0,0 +1,35 @@ + + + + + + + + + + + Checkstyle: + Files: + + + + + + - + Errors: + + + Error Description: + Line: + + + + + + + Summary: + Files: + Errors: + + + diff --git a/android-check-plugin/src/main/resources/findbugs/findbugs.stdout.xsl b/android-check-plugin/src/main/resources/findbugs/findbugs.stdout.xsl new file mode 100644 index 0000000..21a5289 --- /dev/null +++ b/android-check-plugin/src/main/resources/findbugs/findbugs.stdout.xsl @@ -0,0 +1,34 @@ + + + + + + + + + Findbugs: + Files: + + + + + + - + Errors: + + + Error Description: + Line: + - + + + + + + + Summary: + Files: + Errors: + + + diff --git a/android-check-plugin/src/main/resources/pmd/pmd.stdout.xsl b/android-check-plugin/src/main/resources/pmd/pmd.stdout.xsl new file mode 100644 index 0000000..cc7280a --- /dev/null +++ b/android-check-plugin/src/main/resources/pmd/pmd.stdout.xsl @@ -0,0 +1,35 @@ + + + + + + + + + + + PMD: + Files: + + + + + + - + Violations: + + + Violation: + Location: : - : + + + + + + + Summary: + Files: + Violations: + + +