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

ktlint 0.47 displays plenty of warnings about the --disabled_rules argument usage #1599

Closed
0x6675636b796f75676974687562 opened this issue Aug 22, 2022 · 11 comments · Fixed by #1616
Labels
cli ktlint command line interface
Milestone

Comments

@0x6675636b796f75676974687562
Copy link
Contributor

Expected Behavior

The --disabled_rules is a documented flag, so using it should result in no extra warnings:

$ ./ktlint -V
0.47.0
$ ./ktlint --help | grep -A3 disabled
      --disabled_rules=<disabledRules>
                        Comma-separated list of rules to globally disable. To
                          disable standard ktlint rule-set use
                          --disabled_rules=standard

Observed Behavior

Yet, running ktlint 0.47 (with --disabled_rules specified) against any codebase now produces plenty of warnings:

14:36:39.886 [pool-1-thread-1] WARN com.pinterest.ktlint.core.api.UsesEditorConfigProperties - Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
14:36:39.886 [pool-1-thread-1] WARN com.pinterest.ktlint.core.api.UsesEditorConfigProperties - Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
14:36:39.886 [pool-1-thread-1] WARN com.pinterest.ktlint.core.api.UsesEditorConfigProperties - Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
14:36:39.886 [pool-1-thread-1] WARN com.pinterest.ktlint.core.api.UsesEditorConfigProperties - Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
14:36:39.886 [pool-1-thread-1] WARN com.pinterest.ktlint.core.api.UsesEditorConfigProperties - Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
14:36:39.886 [pool-1-thread-1] WARN com.pinterest.ktlint.core.api.UsesEditorConfigProperties - Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
14:36:39.886 [pool-1-thread-1] WARN com.pinterest.ktlint.core.api.UsesEditorConfigProperties - Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.

Steps to Reproduce

  1. Download the fat JAR from https://github.com/pinterest/ktlint/releases/tag/0.47.0.
  2. Download an external ruleset JAR from https://github.com/saveourtool/diktat/releases/latest.
  3. Run the far JAR against any non-empty codebase as
    java -Xmx512m --add-opens java.base/java.lang=ALL-UNNAMED -jar ktlint -R diktat-1.2.3.jar --disabled_rules=standard
  4. A sheetful of warnings will appear. This is a regression against version 0.46.1.

Your Environment

  • Version of ktlint used: 0.47
  • Relevant parts of the .editorconfig settings: none
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): CLI.
  • Version of Gradle used (if applicable): N/A
  • Operating System and version:
    • MINGW64_NT-10.0-19043 unit-725 3.3.4-341.x86_64 2022-05-09 11:56 UTC x86_64 Msys
    • Linux unit-725 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 GNU/Linux
@paul-dingemans
Copy link
Collaborator

Tnx for reporting. The warning is only meant for the .editorconfig property disabled_rules. I missed that this property is also set via the CLI parameter --disabled_rules.

@paul-dingemans paul-dingemans added this to the 0.47.1 milestone Aug 22, 2022
@paul-dingemans paul-dingemans added the cli ktlint command line interface label Aug 22, 2022
@0x6675636b796f75676974687562
Copy link
Contributor Author

Thank you for your response, @paul-dingemans.

@paul-dingemans paul-dingemans pinned this issue Aug 23, 2022
paul-dingemans added a commit to paul-dingemans/ktlint that referenced this issue Aug 27, 2022
… using CLI parameter as otherwise the deprecation warning is displayed

Closes pinterest#1599
paul-dingemans added a commit to paul-dingemans/ktlint that referenced this issue Aug 27, 2022
paul-dingemans added a commit to paul-dingemans/ktlint that referenced this issue Aug 27, 2022
paul-dingemans added a commit to paul-dingemans/ktlint that referenced this issue Aug 28, 2022
@0x6675636b796f75676974687562
Copy link
Contributor Author

Thank you @paul-dingemans!

@0x6675636b796f75676974687562
Copy link
Contributor Author

@paul-dingemans, I confirm this issue is indeed fixed in the latest master.

Thanks!

@shahriar-rahimi-ck
Copy link

I have 0.47.1 installed and I'm still getting this error. How can I get rid of it ?

@paul-dingemans
Copy link
Collaborator

Please, use latest snapshot or wait till release 0.48.x.

@shahriar-rahimi-ck
Copy link

Has this PR not fixed the issue? 0.47.1 has this PR merged already and I am on 0.47.1.

@paul-dingemans
Copy link
Collaborator

Yes, indeed this issue was released in 0.47.1. Could it be that one of your .editorconfig files still contains a disabled_rules parameter? As you have not provided any additional information, I can not help you.

@shahriar-rahimi-ck
Copy link

I don't have any .editorconfig files tho.(Did a search) Where can i find such a file?
Well, please let me know what other data to share. Basically I just installed ktlint using brew without any further modifications and ran ktlint on my android repo right after.

@paul-dingemans
Copy link
Collaborator

Please create a new issue and provide enough details so that your problem becomes reproducible.

@amit-nayar
Copy link

amit-nayar commented Nov 16, 2022

I am also still getting this issue using 0.47.1. I am using ktlint with Spotless which does not pick up .editorconfig, so I am passing the disabled rules as editorConfigOverride.
If I use ktlint_disabled_rules, the warning goes away, but the disabled rules are not picked up.
Here's the relevant gradle code:

subprojects {
    apply plugin: 'com.diffplug.spotless'
    spotless {
        kotlin {
            target '**/*.kt'
            ktlint(Versions.BuildSystem.KtLint).editorConfigOverride([
                    'disabled_rules' : 'package-name',
            ])
        }
    }
}

It works, but it produces many warnings:

Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.

Created an issue #1709

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

Successfully merging a pull request may close this issue.

4 participants