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

Support for globally disabling a rule #208

Closed
jbarr21 opened this issue May 7, 2018 · 5 comments · Fixed by #503
Closed

Support for globally disabling a rule #208

jbarr21 opened this issue May 7, 2018 · 5 comments · Fixed by #503

Comments

@jbarr21
Copy link

jbarr21 commented May 7, 2018

I've seen that this issue of support for globally disabling a rule comes up multiple times. I'd like to propose simple support (not even for a given scope, just across the board) for disabling a comma separated list of rule names in the .editorconfig or some ktlint config file or via command line. This would be an opt-in advanced feature not put any burden on someone who does not want to make any config decisions.

@exsilium
Copy link

exsilium commented May 7, 2018

As much as I would like to see this feature land in ktlint myself, I think the current option is to look into detekt and detekt/detekt#855 specifically, which allows more fine-grained disable/enable of ktlint rules.

@elenigen
Copy link

elenigen commented May 7, 2018

Just to let people know, detekt is not an option for maven projects so far, only available on gradle. 😞

@exsilium
Copy link

exsilium commented May 8, 2018

Although a true statement, there are workarounds...

@tasomaniac
Copy link
Contributor

tasomaniac commented Mar 26, 2019

@elenigen Detekt is not only available for Gradle. It provides a CLI tool that you can run anywhere.

@elenigen
Copy link

Actually, what I wanted to say is, there's no built-in feature for maven, although there's a workaround.

shashachu added a commit to shashachu/ktlint that referenced this issue Jun 6, 2019
Fixes pinterest#208

* Added support for .ktlintignore file - takes a list of rule Ids to disable (ignores comments)
* Currently only supports globally disabling rules, but added some plumbing so that it's easier to support per-file/per-path disabling, or multiple .ktlintignore files
* Re-enabled NoWildcardImports, PackageNameRule
* Un-commented AnnotationRule, MultiLineIfElseRule, and NoItParamInMultilineLambdaRule, and moved disabling into .ktlintignore
shashachu added a commit to shashachu/ktlint that referenced this issue Jun 26, 2019
… disabling rules

Fixes pinterest#208

* Takes in a comma-separated list of rule ids, with namespaces (e.g. `experimental:indent`)
* Re-enabled `NoWildcardImports`, `PackageNameRule`
* Un-commented `AnnotationRule`, `MultiLineIfElseRule`, and `NoItParamInMultilineLambdaRule`, and moved disabling into default `.editorconfig`
* Also cleaned up params passed to lint and format
shashachu added a commit to shashachu/ktlint that referenced this issue Jul 3, 2019
… disabling rules

Fixes pinterest#208

* Takes in a comma-separated list of rule ids, with namespaces (e.g. `experimental:indent`)
* Re-enabled `NoWildcardImports`, `PackageNameRule`
* Un-commented `AnnotationRule`, `MultiLineIfElseRule`, and `NoItParamInMultilineLambdaRule`, and moved disabling into default `.editorconfig`
* Also cleaned up params passed to lint and format
shashachu added a commit that referenced this issue Jul 3, 2019
… disabling rules (#503)

* Add support for disabled_rules property to .editorconfig for globally disabling rules

Fixes #208

* Takes in a comma-separated list of rule ids, with namespaces (e.g. `experimental:indent`)
* Re-enabled `NoWildcardImports`, `PackageNameRule`
* Un-commented `AnnotationRule`, `MultiLineIfElseRule`, and `NoItParamInMultilineLambdaRule`, and moved disabling into default `.editorconfig`
* Also cleaned up params passed to lint and format
sowmyav24 pushed a commit to sowmyav24/ktlint that referenced this issue Jul 18, 2019
… disabling rules (pinterest#503)

* Add support for disabled_rules property to .editorconfig for globally disabling rules

Fixes pinterest#208

* Takes in a comma-separated list of rule ids, with namespaces (e.g. `experimental:indent`)
* Re-enabled `NoWildcardImports`, `PackageNameRule`
* Un-commented `AnnotationRule`, `MultiLineIfElseRule`, and `NoItParamInMultilineLambdaRule`, and moved disabling into default `.editorconfig`
* Also cleaned up params passed to lint and format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants