Skip to content

Commit

Permalink
Improve generateEditorConfig example in docs (#2436)
Browse files Browse the repository at this point in the history
This better demonstrates generating config for different code styles, as per #2436 (comment).
  • Loading branch information
BD103 committed Dec 17, 2023
1 parent b37c3a6 commit f700bd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions documentation/release-latest/docs/install/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ Some rules can be tweaked via the [`editorconfig file`](../../rules/configuratio
A scaffold of the `.editorconfig file` can be generated with command below. Note: that the generated file only contains configuration settings which are actively used by the [rules which are loaded](#rule-sets):

```shell title="Generate .editorconfig"
# By default use ktlint_official
ktlint generateEditorConfig
# or
ktlint generateEditorConfig
ktlint generateEditorConfig intellij_idea
# or
ktlint --ruleset=/path/to/custom-ruleset.jar generateEditorConfig
ktlint --ruleset=/path/to/custom-ruleset.jar generateEditorConfig android_studio
```

Normally this file is located in the root of your project directory. In case the file is located in a sub folder of the project, the settings of that file only applies to that subdirectory and its folders (recursively). Ktlint automatically detects and reads all `.editorconfig` files in your project.
Expand Down
7 changes: 4 additions & 3 deletions documentation/snapshot/docs/install/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ Some rules can be tweaked via the [`editorconfig file`](../../rules/configuratio
A scaffold of the `.editorconfig` file can be generated with command below. Note: that the generated file only contains configuration settings which are actively used by the [rules which are loaded](#rule-sets):

```shell title="Generate .editorconfig"
ktlint generateEditorConfig ktlint_official
# By default use ktlint_official
ktlint generateEditorConfig
# or
ktlint generateEditorConfig ktlint_official
ktlint generateEditorConfig intellij_idea
# or
ktlint --ruleset=/path/to/custom-ruleset.jar generateEditorConfig ktlint_official
ktlint --ruleset=/path/to/custom-ruleset.jar generateEditorConfig android_studio
```

Normally the `.editorconfig` file is located in the root of your project directory. In case the file is located in a sub folder of the project, the settings of that file only applies to that subdirectory and its folders (recursively). Ktlint automatically detects and reads all `.editorconfig` files in your project.
Expand Down

0 comments on commit f700bd1

Please sign in to comment.