Skip to content

Commit

Permalink
Lets try detekt 1.0.0.RC9
Browse files Browse the repository at this point in the history
  • Loading branch information
Ozsie committed Sep 20, 2018
1 parent 3a68dc8 commit 7c0abce
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.0.0.RC8-1-S</version>
<version>1.0.0.RC9</version>
<packaging>maven-plugin</packaging>

<name>detekt-maven-plugin Maven Plugin</name>
Expand All @@ -14,8 +14,9 @@
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>1.2.61</kotlin.version>
<detekt.version>1.0.0.RC8</detekt.version>
<kotlin.version>1.2.70</kotlin.version>
<detekt.version>1.0.0.RC9</detekt.version>
<detekt.maven.version>1.0.0.RC9</detekt.maven.version>
<jcommander.version>1.72</jcommander.version>
<snakeyaml.version>1.21</snakeyaml.version>
</properties>
Expand Down Expand Up @@ -161,7 +162,7 @@
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.0.0.RC6-4</version>
<version>${detekt.maven.version}</version>
<executions>
<execution>
<phase>verify</phase>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/github/ozsie/CheckMojo.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.ozsie

import io.gitlab.arturbosch.detekt.cli.CliArgs
import io.gitlab.arturbosch.detekt.cli.parseArguments
import io.gitlab.arturbosch.detekt.cli.runners.Runner
import org.apache.maven.plugins.annotations.LifecyclePhase
Expand All @@ -13,6 +14,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope
requiresDependencyResolution = ResolutionScope.TEST)
class CheckMojo : DetektMojo() {
override fun execute() {
if (!skip) return Runner(parseArguments(getCliSting().log().toTypedArray())).execute()
val cliArgs = parseArguments<CliArgs>(getCliSting().log().toTypedArray()).first
if (!skip) return Runner(cliArgs).execute()
}
}
4 changes: 3 additions & 1 deletion src/main/java/com/github/ozsie/CreateBaselineMojo.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.ozsie

import io.gitlab.arturbosch.detekt.cli.CliArgs
import io.gitlab.arturbosch.detekt.cli.parseArguments
import io.gitlab.arturbosch.detekt.cli.runners.Runner
import org.apache.maven.plugins.annotations.Mojo
Expand All @@ -8,7 +9,8 @@ import org.apache.maven.plugins.annotations.Mojo
@Mojo(name = "create-baseline")
open class CreateBaselineMojo : DetektMojo() {
override fun execute() {
if (!skip) Runner(parseArguments(cliString)).execute()
val cliArgs = parseArguments<CliArgs>(cliString).first
if (!skip) Runner(cliArgs).execute()
}
private val cliString get() = getCliSting().apply { add(CREATE_BASELINE) }.log().toTypedArray()
}
Expand Down
25 changes: 15 additions & 10 deletions src/main/java/com/github/ozsie/DetektMojo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ const val CONFIG = "-c"
const val CONFIG_RESOURCE = "-cr"
const val FILTERS = "-f"
const val INPUT = "-i"
const val OUTPUT = "-o"
const val OUTPUT_NAME = "-on"
const val PLUGINS = "-p"
const val PRINT_AST = "--print-ast"
const val RUN_RULE = "--run-rule"
const val REPORT = "-r"

const val MDP_ID = "com.github.ozsie:detekt-maven-plugin"

Expand Down Expand Up @@ -56,15 +57,18 @@ abstract class DetektMojo : AbstractMojo() {
@Parameter(property = "detekt.input", defaultValue = "\${basedir}/src")
var input = "\${basedir}/src"

@Parameter(property = "detekt.output", defaultValue = "\${basedir}/detekt")
var output = "\${basedir}/detekt"

@Parameter(property = "detekt.output-name", defaultValue = "")
var outputName = ""

@Parameter(property = "detekt.parallel", defaultValue = "false")
var parallel = false

@Parameter(property = "detekt.printAst", defaultValue = "false")
var printAst = false

@Parameter(property = "detekt.disableDefaultRuleset", defaultValue = "false")
var disableDefaultRuleset = false

@Parameter(property = "detekt.runRule", defaultValue = "")
var runRule = ""

@Parameter(property = "detekt.plugins")
var plugins = ArrayList<String>()

Expand All @@ -83,8 +87,9 @@ abstract class DetektMojo : AbstractMojo() {
.useIf(configResource.isNotEmpty(), CONFIG_RESOURCE, configResource)
.useIf(filters.isNotEmpty(), FILTERS, filters.joinToString(SEMICOLON))
.useIf(input.isNotEmpty(), INPUT, input)
.useIf(output.isNotEmpty(), OUTPUT, output)
.useIf(outputName.isNotEmpty(), OUTPUT_NAME, outputName)
.useIf(runRule.isNotEmpty(), RUN_RULE, runRule)
.useIf(printAst, PRINT_AST)
.useIf(disableDefaultRuleset, DISABLE_DEFAULT_RULE_SET)
.useIf(plugins.isNotEmpty(), PLUGINS, plugins.buildPluginPaths(mavenProject, localRepoLocation))
}

Expand Down

0 comments on commit 7c0abce

Please sign in to comment.