-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from sladyn98/kotlin_plugin
Add support for Kotlin warnings.
- Loading branch information
Showing
9 changed files
with
178 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/io/jenkins/plugins/analysis/warnings/Kotlin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/test/resources/io/jenkins/plugins/analysis/warnings/kotlin.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) $ |