-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mechanism to exclude files from check (#563)
### What's done: * Logic in maven plugin * Tests for maven plugin * Logic in gradle plugin * Tests for gradle plugin * Fixes for metrics_yml
- Loading branch information
Showing
10 changed files
with
140 additions
and
8 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
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
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
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
55 changes: 55 additions & 0 deletions
55
diktat-maven-plugin/src/test/kotlin/org/cqfn/diktat/plugin/maven/DiktatBaseMojoTest.kt
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,55 @@ | ||
package org.cqfn.diktat.plugin.maven | ||
|
||
import junit.framework.Assert | ||
import org.apache.maven.plugin.testing.AbstractMojoTestCase | ||
import kotlin.io.path.ExperimentalPathApi | ||
import kotlin.io.path.createTempFile | ||
import kotlin.io.path.writeText | ||
|
||
/** | ||
* Tests for mojo configuration | ||
* FixMe: inject project version from outside | ||
* FixMe: `@Parameter` properties are not set | ||
*/ | ||
@OptIn(ExperimentalPathApi::class) | ||
class DiktatBaseMojoTest : AbstractMojoTestCase() { | ||
fun `test plugin configuration`() { | ||
val pom = createTempFile() | ||
pom.writeText( | ||
""" | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.cqfn.diktat</groupId> | ||
<artifactId>diktat-test</artifactId> | ||
<version>0.1.6-SNAPSHOT</version> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.cqfn.diktat</groupId> | ||
<artifactId>diktat-maven-plugin</artifactId> | ||
<version>0.1.6-SNAPSHOT</version> | ||
<configuration> | ||
<diktatConfigFile>diktat-analysis.yml</diktatConfigFile> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> | ||
""".trimIndent() | ||
) | ||
val diktatCheckMojo = lookupMojo("check", pom.toFile()) as DiktatCheckMojo | ||
Assert.assertEquals(false, diktatCheckMojo.debug) | ||
Assert.assertEquals("diktat-analysis.yml", diktatCheckMojo.diktatConfigFile) | ||
} | ||
} |
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