File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,37 @@ class KtlintPluginTest : AbstractPluginTest() {
196196 }
197197 }
198198
199+ @DisplayName(" Should ignore excluded sources which are generated during build" )
200+ @CommonTest
201+ fun ignoreExcludedSourcesGeneratedByBuild (gradleVersion : GradleVersion ) {
202+ project(gradleVersion) {
203+ withCleanSources()
204+
205+ // language=Groovy
206+ buildGradle.appendText(
207+ """
208+ ktlint.filter { exclude { it.file.path.contains("Failing") } }
209+
210+ task createExtraFile() {
211+ def rootDir = project.getRootDir().toString()
212+ def fileDir = rootDir + "/src/main/kotlin"
213+ def fileName = "FailingSource.kt"
214+ doLast {
215+ file(fileDir).mkdirs()
216+ file(fileDir + "/" + fileName) << "val foo = \"bar\"\n"
217+ }
218+ }
219+
220+ ${CHECK_PARENT_TASK_NAME } .dependsOn createExtraFile
221+ """ .trimIndent()
222+ )
223+
224+ build(CHECK_PARENT_TASK_NAME ) {
225+ assertThat(task(" :$mainSourceSetCheckTaskName " )?.outcome).isEqualTo(TaskOutcome .SUCCESS )
226+ }
227+ }
228+ }
229+
199230 @DisplayName(" Should fail on additional source set directories files style violation" )
200231 @CommonTest
201232 fun additionalSourceSetsViolations (gradleVersion : GradleVersion ) {
You can’t perform that action at this time.
0 commit comments