diff --git a/README.md b/README.md index 5c9afe9..f41258c 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ The plugin does the next steps: com.github.surpsg diff-coverage-maven-plugin - 0.1.0 + 0.1.1 diff --git a/pom.xml b/pom.xml index c96d022..997a35c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ diff-coverage-maven-plugin ${project.groupId}:${project.artifactId} maven-plugin - 0.1.0 + 0.1.1 Diff coverage maven plugin builds code coverage report of new and modified code based on a provided diff @@ -55,10 +55,10 @@ UTF-8 - 1.3.72 + 1.4.32 true official - 4.12 + 4.13.1 3.6.3 HEAD @@ -92,7 +92,7 @@ org.jetbrains.kotlin - kotlin-stdlib + kotlin-stdlib-jdk8 ${kotlin.version} @@ -105,12 +105,12 @@ com.github.form-com.diff-coverage-gradle jacoco-filtering-extension - 0.7.0 + 0.7.2 org.eclipse.jgit org.eclipse.jgit - 5.7.0.202003110725-r + 5.12.0.202106070339-r @@ -122,9 +122,8 @@ - src/main/kotlin - src/test/kotlin - + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin org.jetbrains.kotlin @@ -133,14 +132,12 @@ compile - compile compile test-compile - test-compile test-compile @@ -157,7 +154,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.7 pre-unit-test @@ -213,7 +210,7 @@ org.apache.maven.plugins maven-invoker-plugin - 3.2.1 + 3.2.2 ${project.build.directory}/it verify @@ -238,7 +235,7 @@ com.github.surpsg diff-coverage-maven-plugin - 0.1.0 + 0.1.1 ${project.build.directory}/fullCoverage.exec diff --git a/settings.xml b/settings.xml index 14e7e85..f061b54 100644 --- a/settings.xml +++ b/settings.xml @@ -2,13 +2,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> - - - ossrh - ${env.USERNAME} - ${env.PASS} - - + ossrh diff --git a/src/it/git-diff-support/pom.xml b/src/it/git-diff-support/pom.xml index dbfd0e4..bfa8e45 100644 --- a/src/it/git-diff-support/pom.xml +++ b/src/it/git-diff-support/pom.xml @@ -7,11 +7,16 @@ it-check-passes 1.0-SNAPSHOT + + 1.8 + 1.8 + + junit junit - 4.12 + 4.13.1 test @@ -21,7 +26,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.7 @@ -33,7 +38,7 @@ com.github.surpsg diff-coverage-maven-plugin - 0.1.0 + 0.1.1 HEAD diff --git a/src/it/reports-generation-check/pom.xml b/src/it/reports-generation-check/pom.xml index 6b894d4..a4ac6cb 100644 --- a/src/it/reports-generation-check/pom.xml +++ b/src/it/reports-generation-check/pom.xml @@ -7,11 +7,16 @@ it-check-passes 1.0-SNAPSHOT + + 1.8 + 1.8 + + junit junit - 4.12 + 4.13.1 test @@ -21,7 +26,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.7 @@ -33,7 +38,7 @@ com.github.surpsg diff-coverage-maven-plugin - 0.1.0 + 0.1.1 diffFile.patch diff --git a/src/it/url-source-check/pom.xml b/src/it/url-source-check/pom.xml index 073c573..4582a8f 100644 --- a/src/it/url-source-check/pom.xml +++ b/src/it/url-source-check/pom.xml @@ -7,11 +7,16 @@ it-check-passes 1.0-SNAPSHOT + + 1.8 + 1.8 + + junit junit - 4.12 + 4.13.1 test @@ -21,7 +26,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.7 @@ -33,7 +38,7 @@ com.github.surpsg diff-coverage-maven-plugin - 0.1.0 + 0.1.1 ${project.baseUri}diffFile.patch diff --git a/src/it/violation-rules-check/pom.xml b/src/it/violation-rules-check/pom.xml index 239f060..84ff4ab 100644 --- a/src/it/violation-rules-check/pom.xml +++ b/src/it/violation-rules-check/pom.xml @@ -7,11 +7,16 @@ it-check-passes 1.0-SNAPSHOT + + 1.8 + 1.8 + + junit junit - 4.12 + 4.13.1 test @@ -21,7 +26,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.7 @@ -33,7 +38,7 @@ com.github.surpsg diff-coverage-maven-plugin - 0.0.1 + 0.1.1 diffFile.patch diff --git a/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt b/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt index b4ec6f9..1e13671 100644 --- a/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt +++ b/src/main/kotlin/com/github/surpsg/DiffCoverageMojo.kt @@ -1,6 +1,9 @@ package com.github.surpsg -import com.form.coverage.* +import com.form.coverage.DiffReport +import com.form.coverage.Report +import com.form.coverage.ReportType +import com.form.coverage.Violation import com.form.coverage.report.ReportGenerator import com.form.coverage.report.analyzable.AnalyzableReport import com.form.coverage.report.analyzable.AnalyzableReportFactory diff --git a/src/main/kotlin/com/github/surpsg/diffsource/JgitDiff.kt b/src/main/kotlin/com/github/surpsg/diffsource/JgitDiff.kt index f44178b..dae8cb8 100644 --- a/src/main/kotlin/com/github/surpsg/diffsource/JgitDiff.kt +++ b/src/main/kotlin/com/github/surpsg/diffsource/JgitDiff.kt @@ -3,21 +3,16 @@ package com.github.surpsg.diffsource import org.eclipse.jgit.api.Git import org.eclipse.jgit.diff.DiffFormatter import org.eclipse.jgit.lib.ConfigConstants -import org.eclipse.jgit.lib.CoreConfig import org.eclipse.jgit.lib.ObjectId import org.eclipse.jgit.lib.Repository -import org.eclipse.jgit.revwalk.RevTree import org.eclipse.jgit.revwalk.RevWalk import org.eclipse.jgit.storage.file.FileRepositoryBuilder import org.eclipse.jgit.treewalk.AbstractTreeIterator import org.eclipse.jgit.treewalk.CanonicalTreeParser import org.eclipse.jgit.treewalk.FileTreeIterator import org.eclipse.jgit.treewalk.filter.TreeFilter -import org.slf4j.LoggerFactory import java.io.ByteArrayOutputStream import java.io.File -import java.lang.IllegalArgumentException -import java.util.logging.Logger class JgitDiff(workingDir: File) { @@ -31,8 +26,8 @@ class JgitDiff(workingDir: File) { }.build() } catch (e: IllegalArgumentException) { throw IllegalArgumentException( - "Git directory not found in the project root ${workingDir.absolutePath}", - e + "Git directory not found in the project root ${workingDir.absolutePath}", + e ) } @@ -43,8 +38,8 @@ class JgitDiff(workingDir: File) { initialize() scan( - getTreeIterator(repository, commit), - FileTreeIterator(repository) + getTreeIterator(repository, commit), + FileTreeIterator(repository) ).forEach { format(it) } @@ -59,16 +54,16 @@ class JgitDiff(workingDir: File) { private fun DiffFormatter.initialize() { setRepository(repository) repository.config.setEnum( - ConfigConstants.CONFIG_CORE_SECTION, - null, - ConfigConstants.CONFIG_KEY_AUTOCRLF, - getCrlf() + ConfigConstants.CONFIG_CORE_SECTION, + null, + ConfigConstants.CONFIG_KEY_AUTOCRLF, + getCrlf() ) pathFilter = TreeFilter.ALL } private fun getTreeIterator(repo: Repository, name: String): AbstractTreeIterator { - val id: ObjectId = repo.resolve(name) + val id: ObjectId = repo.resolve(name) ?: throw IllegalArgumentException("No such commit $name") val parser = CanonicalTreeParser() repo.newObjectReader().use { objectReader -> RevWalk(repo).use { revWalk -> diff --git a/src/test/kotlin/com/github/surpsg/diffsource/JgitDiffTest.kt b/src/test/kotlin/com/github/surpsg/diffsource/JgitDiffTest.kt index 8f28229..37c6d27 100644 --- a/src/test/kotlin/com/github/surpsg/diffsource/JgitDiffTest.kt +++ b/src/test/kotlin/com/github/surpsg/diffsource/JgitDiffTest.kt @@ -10,8 +10,9 @@ class JgitDiffTest { JgitDiff(File("unknown/file/location")) } - @Test(expected = IllegalStateException::class) + @Test(expected = IllegalArgumentException::class) fun `jgit should throw when no such commit`() { - JgitDiff(File(".")).obtain("UNKNOWN_COMMIT") + val jgitDiff = JgitDiff(File(".")) + jgitDiff.obtain("UNKNOWN_COMMIT") } }