Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremymailen committed Jul 14, 2024
1 parent dcb9a5d commit 925917d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ package org.jmailen.gradle.kotlinter.support

import org.gradle.api.GradleException

class KotlinterError(
message: String,
error: Throwable,
) : GradleException(message, error)
class KotlinterError(message: String, error: Throwable) : GradleException(message, error)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ package org.jmailen.gradle.kotlinter.support

import org.gradle.api.GradleException

class LintFailure(
message: String,
) : GradleException(message)
class LintFailure(message: String) : GradleException(message)
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import java.util.concurrent.ConcurrentSkipListSet
* A wrapper for a Reporter that guarantees thread safety and consistent ordering of all the calls to the reporter.
* As a downside, the calls to the wrapped reporter are delayed until the end of the execution.
*/
class SortedThreadSafeReporterWrapper(
private val wrapped: ReporterV2,
) : ReporterV2 {
class SortedThreadSafeReporterWrapper(private val wrapped: ReporterV2) : ReporterV2 {

private val callsToBefore: ConcurrentMap<String, Unit> = ConcurrentHashMap()
private val lintErrorReports: ConcurrentMap<String, ConcurrentSkipListSet<KtlintCliError>> = ConcurrentHashMap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ import org.gradle.work.InputChanges
import org.jmailen.gradle.kotlinter.KotlinterExtension.Companion.DEFAULT_IGNORE_FAILURES
import org.jmailen.gradle.kotlinter.support.findApplicableEditorConfigFiles

abstract class ConfigurableKtLintTask(
projectLayout: ProjectLayout,
objectFactory: ObjectFactory,
) : SourceTask() {
abstract class ConfigurableKtLintTask(projectLayout: ProjectLayout, objectFactory: ObjectFactory) : SourceTask() {

@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
Expand Down Expand Up @@ -51,12 +48,10 @@ internal inline fun <reified K, reified V> ObjectFactory.mapProperty(default: Ma
set(default)
}

inline fun <reified T : Throwable> Throwable.workErrorCauses(): List<Throwable> {
return when (this) {
is MultiCauseException -> this.causes.map { it.cause }
else -> listOf(this.cause)
}.filter {
// class instance comparison doesn't work due to different classloaders
it?.javaClass?.canonicalName == T::class.java.canonicalName
}.filterNotNull()
}
inline fun <reified T : Throwable> Throwable.workErrorCauses(): List<Throwable> = when (this) {
is MultiCauseException -> this.causes.map { it.cause }
else -> listOf(this.cause)
}.filter {
// class instance comparison doesn't work due to different classloaders
it?.javaClass?.canonicalName == T::class.java.canonicalName
}.filterNotNull()
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import java.io.File

abstract class InstallHookTaskTest(
private val taskName: String,
private val hookFile: String,
) : WithGradleTest.Kotlin() {
abstract class InstallHookTaskTest(private val taskName: String, private val hookFile: String) : WithGradleTest.Kotlin() {
private lateinit var projectRoot: File

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ abstract class WithGradleTest {

abstract class Android : WithGradleTest() {

override fun gradleRunnerFor(vararg args: String): GradleRunner {
return defaultRunner(*args)
.withPluginClasspath()
}
override fun gradleRunnerFor(vararg args: String): GradleRunner = defaultRunner(*args)
.withPluginClasspath()
}

abstract class Kotlin : WithGradleTest() {
Expand Down

0 comments on commit 925917d

Please sign in to comment.