diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3c3be2173d..a301ade1b2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,11 +34,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Fix false positive for control flow with empty body (`no-semicolons`) ([#955](https://github.com/pinterest/ktlint/issues/955))
- Fix incorrect indentation for multi-line call expressions in conditions (`indent`) ([#959](https://github.com/pinterest/ktlint/issues/959))
- Fix false positive for trailing comma before right parentheses|bracket|angle (`spacing-around-comma`) ([#975](https://github.com/pinterest/ktlint/issues/975))
+- Fix ktlint CLI could skip checking some of explicetly passed files ([#942](https://github.com/pinterest/ktlint/issues/942))
### Changed
- 'import-ordering' now supports `.editorconfig' default value generation ([#701](https://github.com/pinterest/ktlint/issues/701))
- Update Gradle to `6.7.1` version
-- Update Kotlin to `1.4.20` version
### Removed
- ?
diff --git a/build.gradle b/build.gradle
index 2abedd4bab..83a4354e1f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,7 +4,7 @@ plugins {
}
ext.versions = [
- 'kotlin': gradle.ext.isKotlinDev ? "1.4.20" : "1.4.20",
+ 'kotlin': gradle.ext.isKotlinDev ? "1.4.20-M1" : "1.4.10",
'gradle': '6.6',
'gradle-sha256': 'e6f83508f0970452f56197f610d13c5f593baaf43c0e3c6a571e5967be754025'
]
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 446cb8d2cc..2e0e0fc501 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -771,9 +771,177 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ktlint/src/main/kotlin/com/pinterest/ktlint/internal/FileUtils.kt b/ktlint/src/main/kotlin/com/pinterest/ktlint/internal/FileUtils.kt
index f52fe46e14..f57fbda851 100644
--- a/ktlint/src/main/kotlin/com/pinterest/ktlint/internal/FileUtils.kt
+++ b/ktlint/src/main/kotlin/com/pinterest/ktlint/internal/FileUtils.kt
@@ -12,20 +12,25 @@ import kotlin.system.exitProcess
internal val workDir: String = File(".").canonicalPath
internal fun List.fileSequence(): Sequence {
- val kotlinFiles = if (isEmpty()) {
+ val kotlinFiles: Sequence = if (isEmpty()) {
Glob.from("**/*.kt", "**/*.kts")
.iterate(
Paths.get(workDir),
Glob.IterationOption.SKIP_HIDDEN
)
+ .asSequence()
} else {
- val normalizedPatterns = map(::expandTilde).toTypedArray()
- Glob.from(*normalizedPatterns)
- .iterate(Paths.get(workDir))
+ // Converting List to Array and passing it to Glob.from(patterns) skips some files
+ // See https://github.com/pinterest/ktlint/issues/942
+ map {
+ Glob.from(expandTilde(it))
+ .iterate(Paths.get(workDir))
+ }
+ .asSequence()
+ .flatMap { it.asSequence() }
}
return kotlinFiles
- .asSequence()
.map(Path::toFile)
}
diff --git a/settings.gradle b/settings.gradle
index 6c2ec4a60b..398f0ded34 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -9,7 +9,7 @@ pluginManagement {
}
plugins {
- def kotlinVersion = settings.hasProperty("kotlinDev") ? "1.4.20" : "1.4.20"
+ def kotlinVersion = settings.hasProperty("kotlinDev") ? "1.4.20-M1" : "1.4.10"
id 'org.jetbrains.kotlin.jvm' version kotlinVersion
id 'com.github.breadmoirai.github-release' version '2.2.12'
id 'com.github.johnrengelman.shadow' version '5.0.0'