Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change "setSource", so it also applies the configured filter #715

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- fix "additionalEditorconfig not supported until ktlint 0.49" warning [#712](https://github.com/JLLeitschuh/ktlint-gradle/pull/712)
- update latest version text file manually [#709](https://github.com/JLLeitschuh/ktlint-gradle/pull/709)
- Improve error logging [#711](https://github.com/JLLeitschuh/ktlint-gradle/pull/711)
- Fixed a case, when -on Windows- an exclude filter is ignored [#715](https://github.com/JLLeitschuh/ktlint-gradle/pull/715)

## [11.6.0] - 2023-09-18

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,37 @@ class KtlintPluginTest : AbstractPluginTest() {
}
}

@DisplayName("Should ignore excluded sources which are generated during build")
@CommonTest
fun ignoreExcludedSourcesGeneratedByBuild(gradleVersion: GradleVersion) {
project(gradleVersion) {
withCleanSources()

//language=Groovy
buildGradle.appendText(
"""
ktlint.filter { exclude { it.file.path.contains("Failing") } }

task createExtraFile() {
def rootDir = project.getRootDir().toString()
def fileDir = rootDir + "/src/main/kotlin"
def fileName = "FailingSource.kt"
doLast {
file(fileDir).mkdirs()
file(fileDir + "/" + fileName) << "val foo = \"bar\"\n"
}
}

$CHECK_PARENT_TASK_NAME.dependsOn createExtraFile
""".trimIndent()
)

build(CHECK_PARENT_TASK_NAME) {
assertThat(task(":$mainSourceSetCheckTaskName")?.outcome).isEqualTo(TaskOutcome.SUCCESS)
}
}
}

@DisplayName("Should fail on additional source set directories files style violation")
@CommonTest
fun additionalSourceSetsViolations(gradleVersion: GradleVersion) {
Expand Down
Loading