File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
main/kotlin/org/jlleitschuh/gradle/ktlint/tasks
test/kotlin/org/jlleitschuh/gradle/ktlint Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ abstract class BaseKtLintCheckTask @Inject constructor(
5555 @get:Internal
5656 internal abstract val additionalEditorconfigFile: RegularFileProperty
5757
58- @get:Internal
58+ @get:Input
5959 internal abstract val additionalEditorconfig: MapProperty <String , String >
6060
6161 @get:Incremental
Original file line number Diff line number Diff line change @@ -147,6 +147,26 @@ class EditorConfigTests : AbstractPluginTest() {
147147 }
148148 }
149149
150+ @DisplayName(" Check task should rerun if additionalEditorconfig property changes" )
151+ @CommonTest
152+ fun checkRerunOnAdditionalEditorconfigPropertyChange (gradleVersion : GradleVersion ) {
153+ project(gradleVersion) {
154+ withAdditionalEditorconfigProperty(120 )
155+ withCleanSources()
156+
157+ build(CHECK_PARENT_TASK_NAME ) {
158+ assertThat(task(" :$lintTaskName " )?.outcome).isEqualTo(TaskOutcome .SUCCESS )
159+ }
160+
161+ withAdditionalEditorconfigProperty(10 )
162+
163+ buildAndFail(CHECK_PARENT_TASK_NAME ) {
164+ assertThat(task(" :$lintTaskName " )?.outcome).isEqualTo(TaskOutcome .SUCCESS )
165+ assertThat(task(" :$mainSourceSetCheckTaskName " )?.outcome).isEqualTo(TaskOutcome .FAILED )
166+ }
167+ }
168+ }
169+
150170 private fun TestProject.createEditorconfigFile (
151171 maxLineLength : Int = 120,
152172 filePath : String = ""
@@ -168,4 +188,18 @@ class EditorConfigTests : AbstractPluginTest() {
168188 }
169189 createEditorconfigFile(maxLineLength)
170190 }
191+
192+ private fun TestProject.withAdditionalEditorconfigProperty (
193+ maxLineLength : Int
194+ ) {
195+ // language=Groovy
196+ buildGradle.appendText(
197+ """
198+
199+ ktlint {
200+ additionalEditorconfig["max_line_length"] = "$maxLineLength "
201+ }
202+ """ .trimIndent()
203+ )
204+ }
171205}
You can’t perform that action at this time.
0 commit comments