Skip to content

Commit

Permalink
Merge pull request #984 from Tapchicoma/942/fix-ktlint-doesnot-lint-s…
Browse files Browse the repository at this point in the history
…ome-files

Fix Ktlint CLI could skip checking some of explicetly passed files.
  • Loading branch information
Tapchicoma authored Dec 4, 2020
2 parents a0c15dd + bcf4edb commit 0b8593f
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- ?
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]
Expand Down
174 changes: 171 additions & 3 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -771,9 +771,177 @@
<sha256 value="310a6aa2d90534c32b8f46f1fc98cd0edae95dcdfca23e2847e5efa9ae0c019a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin.jvm" name="org.jetbrains.kotlin.jvm.gradle.plugin" version="1.4.20">
<artifact name="org.jetbrains.kotlin.jvm.gradle.plugin-1.4.20.pom">
<sha256 value="f76379cb0bc19fa5db007167847bdb1ba4b109d7f6825ebdcd31a4c0f3048a95" origin="Generated by Gradle because artifact wasn't signed"/>
<component group="org.jetbrains.kotlin" name="kotlin-android-extensions" version="1.4.10">
<artifact name="kotlin-android-extensions-1.4.10.jar">
<sha256 value="55b9627bceee132f70f8124b279f618ececf8d5cb8ac97c9d30f43cc5b9b3871" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-android-extensions-1.4.10.pom">
<sha256 value="2ae0864b6a2db8f6fea11f56dc1f3d4fdc2d1e328a876b5679e8eace58b38577" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-annotation-processing-gradle" version="1.4.10">
<artifact name="kotlin-annotation-processing-gradle-1.4.10.jar">
<sha256 value="0ba48754df3bcc16fafb3e22c40a251d01115359809cf14cf5f98aef15d902e1" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-annotation-processing-gradle-1.4.10.pom">
<sha256 value="ecf643b89d16fe2d6ad4a7f12755cdf10076545869229dbce43fa1f2445c21fc" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-build-common" version="1.4.10">
<artifact name="kotlin-build-common-1.4.10.jar">
<sha256 value="23c6aa7925e529f0a982539138c69183c038822be149605e5c704f259c1837aa" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-build-common-1.4.10.pom">
<sha256 value="08c7d6fdbe362cf36e9ccc5980675265fbea29721c485f197efac630eec413b6" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-compiler-embeddable" version="1.4.10">
<artifact name="kotlin-compiler-embeddable-1.4.10.jar">
<sha256 value="c0d023cff6ee64d360a5b6d7da17aa068b63a4a721f6323a855249d6737978e6" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-compiler-embeddable-1.4.10.pom">
<sha256 value="10b4c56cf26d87089777abaaa798b96924ebd42b2f59f806bb7a677f06d92fce" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-compiler-runner" version="1.4.10">
<artifact name="kotlin-compiler-runner-1.4.10.jar">
<sha256 value="48380e9de166d82197c8f72e42df19d9981f031ffdbcf1cd246ef6d6deff794d" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-compiler-runner-1.4.10.pom">
<sha256 value="6ac9055b2aeda94eb81993cddcf4fd57c5ab53bab3925ec4c4059426317ae5eb" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-daemon-client" version="1.4.10">
<artifact name="kotlin-daemon-client-1.4.10.jar">
<sha256 value="cc42296727533ff7f5ed103f48142d07f396b1ea81f795defde54eeb1a923a37" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-daemon-client-1.4.10.pom">
<sha256 value="753b98532fe9569a024e466c4537df66ee2ecb4128ba1aed6635a03793bbe750" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-daemon-embeddable" version="1.4.10">
<artifact name="kotlin-daemon-embeddable-1.4.10.jar">
<sha256 value="b0ba729c8bd039e1973bab95a88577fbc407baefaef016acecf73c06a504a05e" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-daemon-embeddable-1.4.10.pom">
<sha256 value="4ce8827541cdb85bfce5bd493b307da13da3c6c5e470f9f2a07f3e578d54b7c5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugin" version="1.4.10">
<artifact name="kotlin-gradle-plugin-1.4.10.jar">
<sha256 value="46e4691796cd1410872325bed8919a0cd12e619fd16243f8f439ea2114acec8f" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-gradle-plugin-1.4.10.pom">
<sha256 value="eef93e0497a587b82d335a299f8a0616be8c19ba82a36f795647409182eb25b5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugin-api" version="1.4.10">
<artifact name="kotlin-gradle-plugin-api-1.4.10.jar">
<sha256 value="83e2d1333ac57832e10eac230f36800fa7fda46a05b7ff76f694714674260cb9" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-gradle-plugin-api-1.4.10.pom">
<sha256 value="226514a326c8224f2ce948b106d8a133e17ab8e114db25a5f3e413c5b70f9ae5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugin-model" version="1.4.10">
<artifact name="kotlin-gradle-plugin-model-1.4.10.jar">
<sha256 value="0f5dff8b67b0ea18f41e4c0547de55b83fc12d777cd0806b80c7c415fc65a78f" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-gradle-plugin-model-1.4.10.pom">
<sha256 value="f16817733e7ea24ec8559e5ac5d3c2d2d4fcd9a4073be3052147d7c5689b1778" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-klib-commonizer-embeddable" version="1.4.10">
<artifact name="kotlin-klib-commonizer-embeddable-1.4.10.jar">
<sha256 value="fe6046a1c68d56c21aa57ee9847ad92ce5a7975e6633082c19deaa4532acc959" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-klib-commonizer-embeddable-1.4.10.pom">
<sha256 value="b6f72d264e25f02dcaee32c8ab2e47d0c6a1cd7934c640406c5e72ed0994b6d4" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-reflect" version="1.4.10">
<artifact name="kotlin-reflect-1.4.10.jar">
<sha256 value="3ab3413ec945f801448360ad97bc6e14fec6d606889ede3c707cc277b4467f45" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-reflect-1.4.10.pom">
<sha256 value="eef345ac9f76f39a8f0364bfbb335619eb506c4e54e1997be1c58dc624b425d9" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-script-runtime" version="1.4.10">
<artifact name="kotlin-script-runtime-1.4.10.jar">
<sha256 value="142c51b9bed14244abdd6ea4551e645be57c3a03a70b9933822e870c05fa8fac" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-script-runtime-1.4.10.pom">
<sha256 value="41357fe0c2608446c7a8f1ceb0259042aa0b94d7d92404d5904024dfb88c075a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-scripting-common" version="1.4.10">
<artifact name="kotlin-scripting-common-1.4.10.jar">
<sha256 value="bda57f354344be674e0a241b4c87248857acb411b9dc8ab65068141016466085" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-scripting-common-1.4.10.pom">
<sha256 value="428551f2529aae79a6dfc3babae871f628d30f5daee8254a339af01dd71ac1cd" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-scripting-compiler-embeddable" version="1.4.10">
<artifact name="kotlin-scripting-compiler-embeddable-1.4.10.jar">
<sha256 value="9741d42f28e4f1d621e421ac2b0a4fb2e5f05b1fd4bfd326545b42de57fda4c1" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-scripting-compiler-embeddable-1.4.10.pom">
<sha256 value="3e231d28644bff51f7a2e8cb1b6ef01e943cf9efb29720faa14166f7b448de7a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-scripting-compiler-impl-embeddable" version="1.4.10">
<artifact name="kotlin-scripting-compiler-impl-embeddable-1.4.10.jar">
<sha256 value="7e369d1ba702082d9daa54674004aef7cb2adf5d2872e758a87674f4c3144836" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-scripting-compiler-impl-embeddable-1.4.10.pom">
<sha256 value="4728fe40c3b32661ca66cde848e7bf78be95fd18aa07e8e36421257152d157f7" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-scripting-jvm" version="1.4.10">
<artifact name="kotlin-scripting-jvm-1.4.10.jar">
<sha256 value="6cc266acac8dc49f5956f3f553c8de5fce0d1757c65a86b83c4ef0625a82ab69" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-scripting-jvm-1.4.10.pom">
<sha256 value="04b8a39c6860998bd6446bf69c425e42af8f155a639915353c257233fecc2ff8" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-stdlib" version="1.4.10">
<artifact name="kotlin-stdlib-1.4.10.jar">
<sha256 value="01ecb09782c042b931c1839acf21a188340b295d05400afd6e3415d4475b8daa" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-stdlib-1.4.10.pom">
<sha256 value="a4b9cfbb4bbda523af1e24d52c775fb9c0f7cb568e48b065d45aeb56e63c2762" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-common" version="1.4.10">
<artifact name="kotlin-stdlib-common-1.4.10.jar">
<sha256 value="4681f2d436a68c7523595d84ed5758e1382f9da0f67c91e6a848690d711274fe" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-stdlib-common-1.4.10.pom">
<sha256 value="63480e72a7d4de742b49a6ff90e45f544ca37f3fe11af8b4839f9cd747515d00" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-util-io" version="1.4.10">
<artifact name="kotlin-util-io-1.4.10.jar">
<sha256 value="254b3aee937206a583fe37e5b0a56b570b18c1ccefd7b47a4f436786d49cb452" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-util-io-1.4.10.pom">
<sha256 value="910c98c585e3a308e93a1c0a021d38dc5e1e3bce1c4cbf04000e4711371ac81a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="kotlin-util-klib" version="1.4.10">
<artifact name="kotlin-util-klib-1.4.10.jar">
<sha256 value="f2ce17a896296ff0ab726934716b2bd06695198e6ed78274afdb1f9e6f283833" origin="Generated by Gradle"/>
</artifact>
<artifact name="kotlin-util-klib-1.4.10.pom">
<sha256 value="db9a950ba9a190d04611e69b1732221ba7035c2796b7d8b6afa69840711cd0ee" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin.jvm" name="org.jetbrains.kotlin.jvm.gradle.plugin" version="1.4.10">
<artifact name="org.jetbrains.kotlin.jvm.gradle.plugin-1.4.10.pom">
<sha256 value="8422088b0b02ae031a093329cb2ab1f8386d5f2385331b7b83e3c1fdffd36398" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlinx" name="kotlinx-coroutines-core" version="1.2.1">
Expand Down
15 changes: 10 additions & 5 deletions ktlint/src/main/kotlin/com/pinterest/ktlint/internal/FileUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,25 @@ import kotlin.system.exitProcess
internal val workDir: String = File(".").canonicalPath

internal fun List<String>.fileSequence(): Sequence<File> {
val kotlinFiles = if (isEmpty()) {
val kotlinFiles: Sequence<Path> = 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<String> to Array<String> 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)
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 0b8593f

Please sign in to comment.