Skip to content

Commit

Permalink
#356 move ignoreFailures to parent class
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillsinyuk committed Jan 18, 2024
1 parent aec6e30 commit 3e339c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
Expand All @@ -14,6 +15,7 @@ import org.gradle.internal.exceptions.MultiCauseException
import org.gradle.work.FileChange
import org.gradle.work.Incremental
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(
Expand All @@ -28,6 +30,9 @@ abstract class ConfigurableKtLintTask(
from(projectLayout.findApplicableEditorConfigFiles().toList())
}

@Input
open val ignoreFailures: Property<Boolean> = objectFactory.property(default = DEFAULT_IGNORE_FAILURES)

protected fun getChangedEditorconfigFiles(inputChanges: InputChanges) =
inputChanges.getFileChanges(editorconfigFiles).map(FileChange::getFile)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ open class FormatTask @Inject constructor(
@Optional
val report: RegularFileProperty = objectFactory.fileProperty()

@Input
val ignoreFailures: Property<Boolean> = objectFactory.property(default = KotlinterExtension.DEFAULT_IGNORE_FAILURES)

@Input
val failBuildWhenCannotAutoFormat: Property<Boolean> = objectFactory.property(
default = KotlinterExtension.DEFAULT_FAIL_BUILD_WHEN_CANNOT_AUTO_FORMAT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import org.gradle.api.file.FileTree
import org.gradle.api.file.ProjectLayout
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputFiles
import org.gradle.api.tasks.PathSensitive
Expand All @@ -16,7 +14,6 @@ import org.gradle.api.tasks.TaskAction
import org.gradle.work.InputChanges
import org.gradle.workers.WorkerExecutor
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
import org.jmailen.gradle.kotlinter.KotlinterExtension.Companion.DEFAULT_IGNORE_FAILURES
import org.jmailen.gradle.kotlinter.support.KotlinterError
import org.jmailen.gradle.kotlinter.support.LintFailure
import org.jmailen.gradle.kotlinter.tasks.lint.LintWorkerAction
Expand All @@ -40,9 +37,6 @@ open class LintTask @Inject constructor(
@PathSensitive(PathSensitivity.RELATIVE)
override fun getSource(): FileTree = super.getSource()

@Input
val ignoreFailures: Property<Boolean> = objectFactory.property(default = DEFAULT_IGNORE_FAILURES)

@TaskAction
fun run(inputChanges: InputChanges) {
val result = with(workerExecutor.noIsolation()) {
Expand Down

0 comments on commit 3e339c7

Please sign in to comment.