Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin plugin #111

Merged
merged 9 commits into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
99 changes: 50 additions & 49 deletions SUPPORTED-FORMATS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--- DO NOT EDIT - Generated by ToolsLister at 2019-05-13T23:09:01.116-->
<!--- DO NOT EDIT - Generated by ToolsLister at 2019-06-17T18:01:05.601-->
# Supported Report Formats

Jenkins' Warnings Next Generation Plugin supports the following report formats.
Expand Down Expand Up @@ -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&#43;&#43;) | |
| 44 | iblinter | ibLinter() | - - | [IBLinter](https://github.com/IBDecodable/IBLinter) | |
| 45 | xlc | xlc() | - - | IBM XLC Compiler | |
| 46 | infer | infer() | - - | [Infer](http://fbinfer.com) | |
Expand All @@ -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&#43;&#43; 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&#43;&#43;) | |
| 99 | xmllint | xmlLint() | - - | XML Lint | |
| 100 | yamllint | yamlLint() | - - | [YamlLint](https://yamllint.readthedocs.io/) | |
| 101 | yui | yuiCompressor() | - - | YUI Compressor | |
| 102 | zptlint | zptLint() | - - | ZPT Lint | |
60 changes: 60 additions & 0 deletions src/main/java/io/jenkins/plugins/analysis/warnings/Kotlin.java
Original file line number Diff line number Diff line change
@@ -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());
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an icon available that can be included in the warnings-plugin? (Check License).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we can use the android one, so NO

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/main/webapp/icons/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Binary file added src/main/webapp/icons/kotlin-24x24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/icons/kotlin-48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
45 changes: 45 additions & 0 deletions src/test/resources/io/jenkins/plugins/analysis/warnings/kotlin.txt
Original file line number Diff line number Diff line change
@@ -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) $