diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a683f682b..62783cd880 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Added a generic JSON parser that reads all properties of the internal `Issue` object. - [PR#57](https://github.com/jenkinsci/warnings-ng-plugin/pull/57): Added a parser for MentorGraphcis Modelsim/Questa. +- [PR#111](https://github.com/jenkinsci/warnings-ng-plugin/pull/111): + Added a Kotlin Parser. ### Fixed - [JENKINS-56007](https://issues.jenkins-ci.org/browse/JENKINS-56007): Obtain the affected files in a process on the diff --git a/SUPPORTED-FORMATS.md b/SUPPORTED-FORMATS.md index 3ff3815220..46d3b2a96b 100644 --- a/SUPPORTED-FORMATS.md +++ b/SUPPORTED-FORMATS.md @@ -1,4 +1,4 @@ - + # Supported Report Formats Jenkins' Warnings Next Generation Plugin supports the following report formats. @@ -60,7 +60,7 @@ the [Analysis Parsers Library](https://github.com/jenkinsci/analysis-model/). | 40 | go-vet | goVet() | - - | Go Vet | | | 41 | groovy | groovyScript() | - - | Groovy Parser | | | 42 | iar-cstat | iarCstat() | - - | IAR C-STAT | | -| 43 | iar | iar() | - - | IAR Compiler (C/C++) | | +| 43 | iar | iar() | - - | IAR Compiler (C/C++) | | | 44 | iblinter | ibLinter() | - - | [IBLinter](https://github.com/IBDecodable/IBLinter) | | | 45 | xlc | xlc() | - - | IBM XLC Compiler | | | 46 | infer | infer() | - - | [Infer](http://fbinfer.com) | | @@ -72,50 +72,51 @@ the [Analysis Parsers Library](https://github.com/jenkinsci/analysis-model/). | 52 | js-hint | jsHint() | - - | JSHint | | | 53 | jslint | jsLint() | - - | [JSLint](https://www.jslint.com) | | | 54 | klocwork | klocWork() | - - | Klocwork | | -| 55 | ktlint | ktLint() | ![Ktlint](src/main/webapp/icons/ktlint-24x24.png) ![Ktlint](src/main/webapp/icons/ktlint-48x48.png) | [Ktlint](https://ktlint.github.io) | | -| 56 | maven-warnings | mavenConsole() | - - | Maven | | -| 57 | taglist | tagList() | - - | [Maven Taglist Plugin](https://www.mojohaus.org/taglist-maven-plugin) | **/taglist.xml | -| 58 | modelsim | modelsim() | - - | MentorGraphics Modelsim/Questa | | -| 59 | metrowerks | metrowerksCodeWarrior() | - - | Metrowerks CodeWarrior | | -| 60 | msbuild | msBuild() | - - | MSBuild | | -| 61 | mypy | myPy() | - - | MyPy | | -| 62 | nag-fortran | nagFortran() | - - | NAG Fortran Compiler | | -| 63 | open-tasks | taskScanner() | ![Open Tasks Scanner](src/main/webapp/icons/open-tasks-24x24.png) ![Open Tasks Scanner](src/main/webapp/icons/open-tasks-48x48.png) | Open Tasks Scanner | - | -| 64 | invalids | invalids() | - - | Oracle Invalids | | -| 65 | pclint | pcLint() | - - | PC-Lint | | -| 66 | pep8 | pep8() | - - | Pep8 | | -| 67 | perforce | perforce() | - - | Perforce Compiler | | -| 68 | perl-critic | perlCritic() | - - | Perl::Critic | | -| 69 | php | php() | - - | PHP Runtime | | -| 70 | php-code-sniffer | phpCodeSniffer() | - - | [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) | | -| 71 | phpstan | phpStan() | ![PHPStan](src/main/webapp/icons/phpstan-24x24.png) ![PHPStan](src/main/webapp/icons/phpstan-48x48.png) | [PHPStan](https://github.com/phpstan/phpstan) | | -| 72 | pit | pit() | ![Pit Test Coverage](src/main/webapp/icons/pit-24x24.png) ![Pit Test Coverage](src/main/webapp/icons/pit-48x48.png) | [Pit Test Coverage](http://pitest.org) | | -| 73 | pmd | pmdParser() | ![PMD](src/main/webapp/icons/pmd-24x24.png) ![PMD](src/main/webapp/icons/pmd-48x48.png) | [PMD](https://pmd.github.io) | **/pmd.xml | -| 74 | prefast | prefast() | - - | PREfast | | -| 75 | puppetlint | puppetLint() | - - | Puppet-Lint | | -| 76 | pydocstyle | pyDocStyle() | - - | Pydocstyle | | -| 77 | pylint | pyLint() | ![Pylint](src/main/webapp/icons/pylint-24x24.png) ![Pylint](src/main/webapp/icons/pylint-48x48.png) | Pylint | | -| 78 | qac | qacSourceCodeAnalyser() | - - | QA-C Sourcecode Analyser | | -| 79 | dupfinder | dupFinder() | ![Resharper dupFinder](src/main/webapp/icons/dry-24x24.png) ![Resharper dupFinder](src/main/webapp/icons/dry-48x48.png) | Resharper dupFinder | | -| 80 | resharper | resharperInspectCode() | ![Resharper InspectCode](src/main/webapp/icons/resharper-24x24.png) ![Resharper InspectCode](src/main/webapp/icons/resharper-48x48.png) | Resharper InspectCode | | -| 81 | robocopy | robocopy() | - - | Robocopy | | -| 82 | rflint | rfLint() | ![Robot Framework Lint](src/main/webapp/icons/robot-framework-24x24.png) ![Robot Framework Lint](src/main/webapp/icons/robot-framework-48x48.png) | Robot Framework Lint | | -| 83 | rubocop | ruboCop() | ![RuboCop](src/main/webapp/icons/rubocop-24x24.png) ![RuboCop](src/main/webapp/icons/rubocop-48x48.png) | RuboCop | | -| 84 | scala | scala() | ![Scala Compiler](src/main/webapp/icons/scala-24x24.png) ![Scala Compiler](src/main/webapp/icons/scala-48x48.png) | Scala Compiler | | -| 85 | simian | simian() | ![Simian](src/main/webapp/icons/dry-24x24.png) ![Simian](src/main/webapp/icons/dry-48x48.png) | Simian | | -| 86 | sonar | sonarQube() | ![SonarQube](src/main/webapp/icons/sonar-24x24.png) ![SonarQube](src/main/webapp/icons/sonar-48x48.png) | SonarQube | **/sonar-report.json | -| 87 | sphinx | sphinxBuild() | - - | Sphinx-build | | -| 88 | spotbugs | spotBugs() | ![SpotBugs](src/main/webapp/icons/spotbugs-24x24.png) ![SpotBugs](src/main/webapp/icons/spotbugs-48x48.png) | [SpotBugs](https://spotbugs.github.io) | **/spotbugsXml.xml | -| 89 | stylecop | styleCop() | - - | StyleCop | | -| 90 | sunc | sunC() | - - | SUN C++ Compiler | | -| 91 | swiftlint | swiftLint() | - - | [SwiftLint](https://github.com/realm/SwiftLint) | | -| 92 | tasking-vx | taskingVx() | - - | TASKING VX Compiler | | -| 93 | code-composer | tiCss() | - - | Texas Instruments Code Composer Studio | | -| 94 | tnsdl | tnsdl() | - - | TNSDL Translator | | -| 95 | tslint | tsLint() | - - | [TSLint](https://palantir.github.io/tslint/) | | -| 96 | issues | issues() | - - | Warnings Plugin Native Format | | -| 97 | diabc | diabC() | - - | Wind River Diab Compiler (C/C++) | | -| 98 | xmllint | xmlLint() | - - | XML Lint | | -| 99 | yamllint | yamlLint() | - - | [YamlLint](https://yamllint.readthedocs.io/) | | -| 100 | yui | yuiCompressor() | - - | YUI Compressor | | -| 101 | zptlint | zptLint() | - - | ZPT Lint | | +| 55 | kotlin | kotlin() | ![Kotlin](src/main/webapp/icons/kotlin-24x24.png) ![Kotlin](src/main/webapp/icons/kotlin-48x48.png) | Kotlin | | +| 56 | ktlint | ktLint() | ![Ktlint](src/main/webapp/icons/ktlint-24x24.png) ![Ktlint](src/main/webapp/icons/ktlint-48x48.png) | [Ktlint](https://ktlint.github.io) | | +| 57 | maven-warnings | mavenConsole() | - - | Maven | | +| 58 | taglist | tagList() | - - | [Maven Taglist Plugin](https://www.mojohaus.org/taglist-maven-plugin) | **/taglist.xml | +| 59 | modelsim | modelsim() | - - | MentorGraphics Modelsim/Questa | | +| 60 | metrowerks | metrowerksCodeWarrior() | - - | Metrowerks CodeWarrior | | +| 61 | msbuild | msBuild() | - - | MSBuild | | +| 62 | mypy | myPy() | - - | MyPy | | +| 63 | nag-fortran | nagFortran() | - - | NAG Fortran Compiler | | +| 64 | open-tasks | taskScanner() | ![Open Tasks Scanner](src/main/webapp/icons/open-tasks-24x24.png) ![Open Tasks Scanner](src/main/webapp/icons/open-tasks-48x48.png) | Open Tasks Scanner | - | +| 65 | invalids | invalids() | - - | Oracle Invalids | | +| 66 | pclint | pcLint() | - - | PC-Lint | | +| 67 | pep8 | pep8() | - - | Pep8 | | +| 68 | perforce | perforce() | - - | Perforce Compiler | | +| 69 | perl-critic | perlCritic() | - - | Perl::Critic | | +| 70 | php | php() | - - | PHP Runtime | | +| 71 | php-code-sniffer | phpCodeSniffer() | - - | [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) | | +| 72 | phpstan | phpStan() | ![PHPStan](src/main/webapp/icons/phpstan-24x24.png) ![PHPStan](src/main/webapp/icons/phpstan-48x48.png) | [PHPStan](https://github.com/phpstan/phpstan) | | +| 73 | pit | pit() | ![Pit Test Coverage](src/main/webapp/icons/pit-24x24.png) ![Pit Test Coverage](src/main/webapp/icons/pit-48x48.png) | [Pit Test Coverage](http://pitest.org) | | +| 74 | pmd | pmdParser() | ![PMD](src/main/webapp/icons/pmd-24x24.png) ![PMD](src/main/webapp/icons/pmd-48x48.png) | [PMD](https://pmd.github.io) | **/pmd.xml | +| 75 | prefast | prefast() | - - | PREfast | | +| 76 | puppetlint | puppetLint() | - - | Puppet-Lint | | +| 77 | pydocstyle | pyDocStyle() | - - | Pydocstyle | | +| 78 | pylint | pyLint() | ![Pylint](src/main/webapp/icons/pylint-24x24.png) ![Pylint](src/main/webapp/icons/pylint-48x48.png) | Pylint | | +| 79 | qac | qacSourceCodeAnalyser() | - - | QA-C Sourcecode Analyser | | +| 80 | dupfinder | dupFinder() | ![Resharper dupFinder](src/main/webapp/icons/dry-24x24.png) ![Resharper dupFinder](src/main/webapp/icons/dry-48x48.png) | Resharper dupFinder | | +| 81 | resharper | resharperInspectCode() | ![Resharper InspectCode](src/main/webapp/icons/resharper-24x24.png) ![Resharper InspectCode](src/main/webapp/icons/resharper-48x48.png) | Resharper InspectCode | | +| 82 | robocopy | robocopy() | - - | Robocopy | | +| 83 | rflint | rfLint() | ![Robot Framework Lint](src/main/webapp/icons/robot-framework-24x24.png) ![Robot Framework Lint](src/main/webapp/icons/robot-framework-48x48.png) | Robot Framework Lint | | +| 84 | rubocop | ruboCop() | ![RuboCop](src/main/webapp/icons/rubocop-24x24.png) ![RuboCop](src/main/webapp/icons/rubocop-48x48.png) | RuboCop | | +| 85 | scala | scala() | ![Scala Compiler](src/main/webapp/icons/scala-24x24.png) ![Scala Compiler](src/main/webapp/icons/scala-48x48.png) | Scala Compiler | | +| 86 | simian | simian() | ![Simian](src/main/webapp/icons/dry-24x24.png) ![Simian](src/main/webapp/icons/dry-48x48.png) | Simian | | +| 87 | sonar | sonarQube() | ![SonarQube](src/main/webapp/icons/sonar-24x24.png) ![SonarQube](src/main/webapp/icons/sonar-48x48.png) | SonarQube | **/sonar-report.json | +| 88 | sphinx | sphinxBuild() | - - | Sphinx-build | | +| 89 | spotbugs | spotBugs() | ![SpotBugs](src/main/webapp/icons/spotbugs-24x24.png) ![SpotBugs](src/main/webapp/icons/spotbugs-48x48.png) | [SpotBugs](https://spotbugs.github.io) | **/spotbugsXml.xml | +| 90 | stylecop | styleCop() | - - | StyleCop | | +| 91 | sunc | sunC() | - - | SUN C++ Compiler | | +| 92 | swiftlint | swiftLint() | - - | [SwiftLint](https://github.com/realm/SwiftLint) | | +| 93 | tasking-vx | taskingVx() | - - | TASKING VX Compiler | | +| 94 | code-composer | tiCss() | - - | Texas Instruments Code Composer Studio | | +| 95 | tnsdl | tnsdl() | - - | TNSDL Translator | | +| 96 | tslint | tsLint() | - - | [TSLint](https://palantir.github.io/tslint/) | | +| 97 | issues | issues() | - - | [Warnings Plugin Native Format](https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md#export-your-issues-into-a-supported-format) | | +| 98 | diabc | diabC() | - - | Wind River Diab Compiler (C/C++) | | +| 99 | xmllint | xmlLint() | - - | XML Lint | | +| 100 | yamllint | yamlLint() | - - | [YamlLint](https://yamllint.readthedocs.io/) | | +| 101 | yui | yuiCompressor() | - - | YUI Compressor | | +| 102 | zptlint | zptLint() | - - | ZPT Lint | | diff --git a/src/main/java/io/jenkins/plugins/analysis/warnings/Kotlin.java b/src/main/java/io/jenkins/plugins/analysis/warnings/Kotlin.java new file mode 100644 index 0000000000..9f25423b63 --- /dev/null +++ b/src/main/java/io/jenkins/plugins/analysis/warnings/Kotlin.java @@ -0,0 +1,60 @@ +package io.jenkins.plugins.analysis.warnings; + +import edu.hm.hafner.analysis.IssueParser; +import edu.hm.hafner.analysis.parser.JavacParser; +import edu.umd.cs.findbugs.annotations.NonNull; +import hudson.Extension; +import io.jenkins.plugins.analysis.core.model.IconLabelProvider; +import io.jenkins.plugins.analysis.core.model.ReportScanningTool; +import io.jenkins.plugins.analysis.core.model.StaticAnalysisLabelProvider; +import org.jenkinsci.Symbol; +import org.kohsuke.stapler.DataBoundConstructor; + +/** + * Provides a parser and customized messages for Kotlin errors and warnings. + * + * @author Sladyn Nunes + */ +public class Kotlin extends ReportScanningTool { + private static final long serialVersionUID = 2618843071479627178L; // To be added + private static final String ID = "kotlin"; + + /** + * Creates a new instance of {@link Kotlin}. + */ + @DataBoundConstructor + public Kotlin() { + super(); + // empty constructor required for stapler + } + + @Override + public IssueParser createParser() { + return new JavacParser(); + } + + /** + * Descriptor for this static analysis tool. + */ + @Symbol("kotlin") + @Extension + public static class Descriptor extends ReportScanningToolDescriptor { + /** + * Creates the descriptor instance. + */ + public Descriptor() { + super(ID); + } + + @NonNull + @Override + public String getDisplayName() { + return Messages.Warnings_Kotlin_ParserName(); + } + + @Override + public StaticAnalysisLabelProvider getLabelProvider() { + return new IconLabelProvider(getId(), getDisplayName()); + } + } +} diff --git a/src/main/resources/io/jenkins/plugins/analysis/warnings/Messages.properties b/src/main/resources/io/jenkins/plugins/analysis/warnings/Messages.properties index 39e1911346..5a970d5c16 100644 --- a/src/main/resources/io/jenkins/plugins/analysis/warnings/Messages.properties +++ b/src/main/resources/io/jenkins/plugins/analysis/warnings/Messages.properties @@ -55,6 +55,7 @@ Warnings.Cargo.ParserName=Cargo Warnings.AcuCobol.ParserName=AcuCobol Compiler Warnings.JavaParser.ParserName=Java Warnings.JavaDoc.ParserName=JavaDoc +Warnings.Kotlin.ParserName=Kotlin Warnings.EclipseParser.ParserName=Eclipse ECJ Warnings.Taglist.ParserName=Maven Taglist Plugin Warnings.Maven.ParserName=Maven diff --git a/src/main/webapp/icons/LICENSE.txt b/src/main/webapp/icons/LICENSE.txt index fd0f4b9715..cd395d6aad 100644 --- a/src/main/webapp/icons/LICENSE.txt +++ b/src/main/webapp/icons/LICENSE.txt @@ -122,3 +122,12 @@ At the time of writing: The icons were downloaded from the official robot framework visual identity github page and were resized. No other modifications were made. + + +------------------------------------------------------------------------------ + +License for Kotlin Icons + +The kotlin logo has been referenced from https://kotlinlang.org/docs/reference/faq.html#where-can-i-get-an-hd-kotlin-logo +The link to https://www.jetbrains.com has been provided as a license agreement. +No modifications to the icon were made except the scale has been brought down to 48x48. \ No newline at end of file diff --git a/src/main/webapp/icons/kotlin-24x24.png b/src/main/webapp/icons/kotlin-24x24.png new file mode 100644 index 0000000000..02d288dbed Binary files /dev/null and b/src/main/webapp/icons/kotlin-24x24.png differ diff --git a/src/main/webapp/icons/kotlin-48x48.png b/src/main/webapp/icons/kotlin-48x48.png new file mode 100644 index 0000000000..c5a8909198 Binary files /dev/null and b/src/main/webapp/icons/kotlin-48x48.png differ diff --git a/src/test/java/io/jenkins/plugins/analysis/warnings/ParsersITest.java b/src/test/java/io/jenkins/plugins/analysis/warnings/ParsersITest.java index 5171aeca4e..3a47264545 100644 --- a/src/test/java/io/jenkins/plugins/analysis/warnings/ParsersITest.java +++ b/src/test/java/io/jenkins/plugins/analysis/warnings/ParsersITest.java @@ -737,7 +737,17 @@ public void shouldFindAllJavaIssues() { shouldFindIssuesOfTool(2 + 1 + 1 + 2, new Java(), "javac.txt", "gradle.java.log", "ant-javac.txt", "hpi.txt"); } - /** Runs the CssLint parser on an output file that contains 51 issues. */ + /** + * Runs the Kotlin parser on several output files that contain 1 issues. + */ + @Test + public void shouldFindAllKotlinIssues() { + shouldFindIssuesOfTool(1, new Kotlin(), "kotlin.txt"); + } + + /** + * Runs the CssLint parser on an output file that contains 51 issues. + */ @Test public void shouldFindAllCssLintIssues() { shouldFindIssuesOfTool(51, new CssLint(), "csslint.xml"); diff --git a/src/test/resources/io/jenkins/plugins/analysis/warnings/kotlin.txt b/src/test/resources/io/jenkins/plugins/analysis/warnings/kotlin.txt new file mode 100644 index 0000000000..c2e0494bcc --- /dev/null +++ b/src/test/resources/io/jenkins/plugins/analysis/warnings/kotlin.txt @@ -0,0 +1,45 @@ +[INFO] Scanning for projects... +[INFO] +[INFO] ----------< com.michaelrice.kotlin:hello-world-maven-example >---------- +[INFO] Building hello-world-maven-example 1.0 +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello-world-maven-example --- +[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! +[INFO] skip non existing resourceDirectory /Users/hafner/Development/git/kotlin-maven-hello-world/src/main/resources +[INFO] +[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ hello-world-maven-example --- +[INFO] Nothing to compile - all classes are up to date +[INFO] +[INFO] --- kotlin-maven-plugin:1.1.2:compile (compile) @ hello-world-maven-example --- +[INFO] Kotlin Compiler version 1.1.2 +[INFO] Compiling Kotlin sources from [/Users/hafner/Development/git/kotlin-maven-hello-world/src/main/kotlin] +[INFO] Module name is hello-world-maven-example +[WARNING] /Users/hafner/Development/git/kotlin-maven-hello-world/src/main/kotlin/hello.kt: (4, 11) Parameter 'args' is never used +[INFO] +[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello-world-maven-example --- +[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! +[INFO] skip non existing resourceDirectory /Users/hafner/Development/git/kotlin-maven-hello-world/src/test/resources +[INFO] +[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ hello-world-maven-example --- +[INFO] No sources to compile +[INFO] +[INFO] --- kotlin-maven-plugin:1.1.2:test-compile (test-compile) @ hello-world-maven-example --- +[INFO] Kotlin Compiler version 1.1.2 +[WARNING] No sources found skipping Kotlin compile +[INFO] +[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hello-world-maven-example --- +[INFO] No tests to run. +[INFO] +[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ hello-world-maven-example --- +[INFO] Building jar: /Users/hafner/Development/git/kotlin-maven-hello-world/target/hello-world-maven-example-1.0.jar +[INFO] +[INFO] --- maven-assembly-plugin:2.6:single (make-assembly) @ hello-world-maven-example --- +[INFO] Building jar: /Users/hafner/Development/git/kotlin-maven-hello-world/target/hello-world-maven-example-1.0-jar-with-dependencies.jar +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 3.100 s +[INFO] Finished at: 2019-06-12T21:47:44+02:00 +[INFO] ------------------------------------------------------------------------ +~/D/g/kotlin-maven-hello-world (master|✚1) $ \ No newline at end of file