From ec48fa514bb12cb8a627e3708c036f1cc1d72914 Mon Sep 17 00:00:00 2001 From: Josef Raska <6277721+jraska@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:44:34 +0200 Subject: [PATCH] Remove unused interface (#269) --- .../main/kotlin/com/jraska/module/graph/DependencyMatcher.kt | 5 ----- .../com/jraska/module/graph/RegexpDependencyMatcher.kt | 4 ++-- .../module/graph/assertion/RestrictedDependenciesAssert.kt | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) delete mode 100644 plugin/src/main/kotlin/com/jraska/module/graph/DependencyMatcher.kt diff --git a/plugin/src/main/kotlin/com/jraska/module/graph/DependencyMatcher.kt b/plugin/src/main/kotlin/com/jraska/module/graph/DependencyMatcher.kt deleted file mode 100644 index 794cac6..0000000 --- a/plugin/src/main/kotlin/com/jraska/module/graph/DependencyMatcher.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.jraska.module.graph - -interface DependencyMatcher { - fun matches(dependency: Pair): Boolean -} diff --git a/plugin/src/main/kotlin/com/jraska/module/graph/RegexpDependencyMatcher.kt b/plugin/src/main/kotlin/com/jraska/module/graph/RegexpDependencyMatcher.kt index 71f71fc..62424a9 100644 --- a/plugin/src/main/kotlin/com/jraska/module/graph/RegexpDependencyMatcher.kt +++ b/plugin/src/main/kotlin/com/jraska/module/graph/RegexpDependencyMatcher.kt @@ -3,9 +3,9 @@ package com.jraska.module.graph class RegexpDependencyMatcher( private val matchingRegex: Regex, private val divider: String -) : DependencyMatcher { +) { - override fun matches(dependency: Pair): Boolean { + fun matches(dependency: Pair): Boolean { val dependencyToMatch = "${dependency.first}$divider${dependency.second}" return matchingRegex.matches(dependencyToMatch) } diff --git a/plugin/src/main/kotlin/com/jraska/module/graph/assertion/RestrictedDependenciesAssert.kt b/plugin/src/main/kotlin/com/jraska/module/graph/assertion/RestrictedDependenciesAssert.kt index a0e8a88..0f56e58 100644 --- a/plugin/src/main/kotlin/com/jraska/module/graph/assertion/RestrictedDependenciesAssert.kt +++ b/plugin/src/main/kotlin/com/jraska/module/graph/assertion/RestrictedDependenciesAssert.kt @@ -1,8 +1,8 @@ package com.jraska.module.graph.assertion import com.jraska.module.graph.DependencyGraph -import com.jraska.module.graph.DependencyMatcher import com.jraska.module.graph.Parse +import com.jraska.module.graph.RegexpDependencyMatcher import org.gradle.api.GradleException class RestrictedDependenciesAssert( @@ -24,7 +24,7 @@ class RestrictedDependenciesAssert( } } - private fun buildErrorMessage(failedDependencies: List>>): String { + private fun buildErrorMessage(failedDependencies: List>>): String { return failedDependencies.map { val violatedRules = it.second.map { "'$it'" }.joinToString(", ") "Dependency '${it.first.assertDisplayText()} violates: $violatedRules"