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

Passing in argument disabled_rules is broken in 0.46.x #1520

Closed
liutikas opened this issue Jun 25, 2022 · 3 comments · Fixed by #1525
Closed

Passing in argument disabled_rules is broken in 0.46.x #1520

liutikas opened this issue Jun 25, 2022 · 3 comments · Fixed by #1525
Milestone

Comments

@liutikas
Copy link
Contributor

Expected Behavior

ktlint follows arguments passed to it via commandline

Observed Behavior

ktlint seems to be ignoring --disabled_rules= arguments

/usr/local/buildtools/java/jdk11/bin/java -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest/ktlint/0.46.1/98e3f71ed1c4fa622a67cf9345bac8acb257679/ktlint-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-baseline/0.46.1/d8fdf1db5d814430064c27b643672317bd6c095c/ktlint-reporter-baseline-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-checkstyle/0.46.1/9d4ae06b2ecf14cd2a060d0959ea25e4e318589f/ktlint-reporter-checkstyle-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-json/0.46.1/9451460b7a2316dc580924339b92fe0772b1558f/ktlint-reporter-json-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-html/0.46.1/d972b5af6d9f82dfebfc51f77073c34a601e5f28/ktlint-reporter-html-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-plain/0.46.1/8bd3b1c756abb4a434695444f7881e2bcb605da3/ktlint-reporter-plain-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-sarif/0.46.1/b730be981f502faa68bbc01acb1fad1c817dba4b/ktlint-reporter-sarif-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-ruleset-experimental/0.46.1/8f0c7ec8778230bfd5e4570a7c230de728412efd/ktlint-ruleset-experimental-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-ruleset-standard/0.46.1/44c04a5572ff64114e2953581320bc44c33d4d91/ktlint-ruleset-standard-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-ruleset-test/0.46.1/fb016718b3b9071d69a31f7bc8be258bb1638256/ktlint-ruleset-test-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-core/0.46.1/be457a1d537f2f4253d5b0d04c248b43aaf786ab/ktlint-core-0.46.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.7.0/4d09852239f61842072b40b524882fa3caaed371/kotlin-compiler-embeddable-1.7.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/com.github.shyiko.klob/klob/0.2.1/f6bc8b98c3fcce8a559beb2b6e8ec58efadb5bbe/klob-0.2.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/info.picocli/picocli/4.6.3/18177f4c3d65cc94e6d4039775ec5aed8089f8d0/picocli-4.6.3.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.11/4741689214e9d1e8408b206506cbe76d1c6a7d60/logback-classic-1.2.11.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/io.github.microutils/kotlin-logging-jvm/2.1.21/7a65a2789a27c67c281a4fe9e78689cf5e2b36d8/kotlin-logging-jvm-2.1.21.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.7.0/362da0b4951ed79a6591743a7fddcfb8c73809f6/kotlin-stdlib-jdk8-1.7.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.ec4j.core/ec4j-core/0.3.0/fbe9f33ab6ba108316c6e4ef986f960cff190d3d/ec4j-core-0.3.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/io.github.detekt.sarif4k/sarif4k/0.0.1/9083c4703896cfe82b20f085d7279bf8d5e85219/sarif4k-0.0.1.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.7.0/e660b0079fdaf744dc9cc7f6f3aa3c761ec839b0/kotlin-reflect-1.7.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.7.0/fbeaa8fa63cbab09c547083a449097be6660a9a/kotlin-stdlib-jdk7-1.7.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-json-jvm/1.1.0/86c26030512eb057e02c9bfcfdfd9e2fbb82201/kotlinx-serialization-json-jvm-1.1.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-serialization-core-jvm/1.1.0/6a6d0b8e8a44c48e206e435d279b1773832f4f1b/kotlinx-serialization-core-jvm-1.1.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.0/a5f42c684ad9003160ef0d0f693ecf0ba7b13549/kotlin-stdlib-1.7.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-script-runtime/1.7.0/3acea1d447587e61bc3e1b3ed6227d9e9ed4ddf1/kotlin-script-runtime-1.7.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-daemon-embeddable/1.7.0/fd56798de80825c673ac93808284c5198ffa2b50/kotlin-daemon-embeddable-1.7.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.intellij.deps/trove4j/1.0.20200330/3afb14d5f9ceb459d724e907a21145e8ff394f02/trove4j-1.0.20200330.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/net.java.dev.jna/jna/5.6.0/330f2244e9030119ab3030fc3fededc86713d9cc/jna-5.6.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.2.11/a01230df5ca5c34540cdaa3ad5efb012f1f1f792/logback-core-1.2.11.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.32/cdcff33940d9f2de763bc41ea05a0be5941176c3/slf4j-api-1.7.32.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.0/51736992f422993a1e741051bdf3c12801bc1ca1/kotlin-stdlib-common-1.7.0.jar:/usr/local/google/home/aurimas/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar com.pinterest.ktlint.Main --android --disabled_rules final-newline --reporter=plain src/**/*.kt

has output

/ssd/ssd1/temp/ktlint-repro/lib/src/main/kotlin/com/example/Library.kt:1:1: File must end with a newline (\n) (final-newline)

for an input file that has no final newline

Steps to Reproduce

https://github.com/liutikas/ktlint-ignoring-arguments-repro
Follow readme.md

Your Environment

  • Version of ktlint used: 0.46.1
  • Relevant parts of the .editorconfig settings: not present
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): task in lib/build.gradle.kts of the repro project
  • Version of Gradle used (if applicable): 7.4
  • Operating System and version: Linux
@paul-dingemans
Copy link
Collaborator

The executed command does not contain the "=" sign after disabled_rules:

com.pinterest.ktlint.Main --android --disabled_rules final-newline --reporter=plain src/**/*.kt

But when adding the missing = it still does not work with version 0.46.x. With version 0.45.2 it still works, so I am affraid this is a regression bug. Tnx for reporting.

@paul-dingemans paul-dingemans added this to the 0.46.2 milestone Jun 26, 2022
@paul-dingemans paul-dingemans changed the title Passing in arguments through commandline seem to be broken Passing in argument disabled_rules is broken in 0.46.x Jun 26, 2022
paul-dingemans added a commit to paul-dingemans/ktlint that referenced this issue Jun 26, 2022
@paul-dingemans paul-dingemans pinned this issue Jun 26, 2022
paul-dingemans added a commit that referenced this issue Jun 27, 2022
* Fix regression on command line argument "--disabled_rules" and align code other unit tests

Closes #1520
@paul-dingemans paul-dingemans modified the milestones: 0.46.2, 0.47.0 Jul 17, 2022
@paul-dingemans paul-dingemans unpinned this issue Aug 22, 2022
@krisgiesing
Copy link

This still seems to be broken in 47.0:

ktlint --android --disabled_rules=no-wildcard-imports MyFile.kt
<lots of warnings pursuant to #1599>
MyFile.kt:12:1: Wildcard import (cannot be auto-corrected) (no-wildcard-imports)

@paul-dingemans
Copy link
Collaborator

This still seems to be broken in 47.0:

ktlint --android --disabled_rules=no-wildcard-imports MyFile.kt
<lots of warnings pursuant to #1599>
MyFile.kt:12:1: Wildcard import (cannot be auto-corrected) (no-wildcard-imports)

Please open new issue in case you think it is still broken in 0.47. The warnings displayed (#1599) have do not break the functionalility. Also see #1614 for some wildcard imports which are allowed by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants