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

Leave cli parameter disabled-rules #2397

Closed
nulls opened this issue Dec 1, 2023 · 4 comments
Closed

Leave cli parameter disabled-rules #2397

nulls opened this issue Dec 1, 2023 · 4 comments

Comments

@nulls
Copy link
Contributor

nulls commented Dec 1, 2023

Diktat uses KtLint to run diktat as CLI: ktlint -R ditkat.jar --disabled-rules=standard. Now we see the following output:

15:04:38.861 [main] WARN com.pinterest.ktlint.cli.internal.KtlintCommandLine - Parameter `--disabled-rules is deprecated, and will be removed in Ktlint 1.1. The disabled rules have to be defined as '.editorconfig' properties. See https://pinterest.github.io/ktlint/1.0.0/faq/#how-do-i-enable-or-disable-a-rule

Expected Behavior

  • Leave this parameter
  • Disable all standard rules by prefix instead of setting all rule names

Current Behavior

  • Disable only a single rule, not all standard rules

Additional information

KtLint version 1.0

@paul-dingemans
Copy link
Collaborator

An entire rule set can also be disabled via the .editorconfig. See https://pinterest.github.io/ktlint/latest/faq/#how-do-i-enable-or-disable-a-rule-set. CLI parameter is therefore not needed.

@nulls
Copy link
Contributor Author

nulls commented Dec 1, 2023

An entire rule set can also be disabled via the .editorconfig. See https://pinterest.github.io/ktlint/latest/faq/#how-do-i-enable-or-disable-a-rule-set. CLI parameter is therefore not needed.

Hi, thanks for reply.

We saw that rules can be disabled via .editorconfig, but we don't use .editorconfig in diktat and don't expect that users have that.
Our use case is run Diktat in CLI using KtLint and we want to run it without another rules which formatting can intersect with our and get unexpected result.

@paul-dingemans
Copy link
Collaborator

If Diktat is a CLI which wraps the Ktlint CLI it might be better to hook directly to the KtLintRuleEngine instead of relying on the Ktlint CLI. KtLintRuleEngine has functionality in which you can inject properties as if they were read from a real .editorconfig file. Also, you will gain more control over how and what to scan.

The idea behind removing the CLI parameters is to keep configuration for ktlint in one single place (the .editorconfig).

@nulls
Copy link
Contributor Author

nulls commented Dec 4, 2023

If Diktat is a CLI which wraps the Ktlint CLI it might be better to hook directly to the KtLintRuleEngine instead of relying on the Ktlint CLI. KtLintRuleEngine has functionality in which you can inject properties as if they were read from a real .editorconfig file. Also, you will gain more control over how and what to scan.

The idea behind removing the CLI parameters is to keep configuration for ktlint in one single place (the .editorconfig).

Thanks for the response.

I think the issue can be closed.

@nulls nulls closed this as completed Dec 4, 2023
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

No branches or pull requests

2 participants