Skip to content

Commit

Permalink
Docs (#2242)
Browse files Browse the repository at this point in the history
* Add warning for changed maven coordinates
* Update default code style
* Remove invalid CLI flags
  • Loading branch information
paul-dingemans committed Sep 5, 2023
1 parent 181f0c0 commit 0b4c4f5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 26 deletions.
2 changes: 0 additions & 2 deletions documentation/release-latest/docs/install/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ ktlint installGitPrePushHook

### Miscellaneous flags and commands

`-a` or `--android`: Turn on Android Kotlin Style Guide compatibility. This flag is most likely to be removed in a future version. Use [`.editorconfig ktlint_code_style`](../../rules/configuration-ktlint/#code-style).

`--color` and `--color-name=<colorName>`: Make output colorful and optionally set the color name to use.

`--disabled_rules=<disabledRules>`: A comma-separated list of rules to globally disable. To disable the standard ktlint rule-set use `--disabled_rules=standard`. This flag is most likely to be removed in a future version. Use [`.editorconfig disabled_rules`](../../rules/configuration-ktlint/#disabled-rules).
Expand Down
12 changes: 5 additions & 7 deletions documentation/release-latest/docs/rules/code-styles.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
The code style `ktlint_official` is first introduced in version `0.49`. This code style is work in progress but will become the default code style in the `1.0` release. Please try out the new code style and provide your feedback via the [issue tracker](https://github.com/pinterest/ktlint/issues).
Starting from version `1.0`, `ktlint_official` is the default code style. If you want to revert to another code style, then set the `.editorconfig` property `ktlint_code_style`.

```ini
[*.{kt,kts}]
ktlint_code_style = ktlint_official
ktlint_code_style = intellij_idea # or android_studio or ktlint_official (default)
```

This `ktlint_official` code style combines the best elements from the [Kotlin Coding conventions](https://kotlinlang.org/docs/coding-conventions.html) and [Android's Kotlin styleguide](https://developer.android.com/kotlin/style-guide). This code style also provides additional formatting on topics which are not (explicitly) mentioned in those conventions and style guide.
The `ktlint_official` code style combines the best elements from the [Kotlin Coding conventions](https://kotlinlang.org/docs/coding-conventions.html) and [Android's Kotlin styleguide](https://developer.android.com/kotlin/style-guide). This code style also provides additional formatting on topics which are not (explicitly) mentioned in those conventions and style guide.

!!! note
Be aware that this code style in some cases formats code in a way which is not accepted by the default code formatters in IntelliJ IDEA and Android Studio. The formatters of those editors produce nicely formatted code in the vast majority of cases. But in a number of edge cases, the formatting contains bugs which are waiting to be fixed for several years. The new code style formats code in a way which is compatible with the default formatting of the editors whenever possible. When using this codestyle, it is best to disable (e.g. not use) code formatting in the editor.

The existing code styles have been renamed to make more clear what the basis of the code style is.
* The `intellij_idea` (formerly `official`) code style aims to be compatible with default formatter of IntelliJ IDEA. This code style is based on [Kotlin Coding conventions](https://kotlinlang.org/docs/coding-conventions.html).

* The `official` code style has been renamed to `intellij_idea`. Code formatted with this code style aims to be compatible with default formatter of IntelliJ IDEA. This code style is based on [Kotlin Coding conventions](https://kotlinlang.org/docs/coding-conventions.html). If `.editorconfig` property `ktlint_code_style` has been set to `official` then do not forget to change the value of that property to `intellij_idea`. When not set, this is the default code style. Be aware that the default code style will be changed to `ktlint_official` in the `1.0` release.

* Code style `android` has been renamed to `android_studio`. Code formatted with this code style aims to be compatible with default formatter of Android Studio. This code style is based on [Android's Kotlin styleguide](https://developer.android.com/kotlin/style-guide). If `.editorconfig` property `ktlint_code_style` has been set to `android` then do not forget to change the value of that property to `android_studio`.
* The `android_studio` (formerly `android`) aims to be compatible with default formatter of Android Studio. This code style is based on [Android's Kotlin styleguide](https://developer.android.com/kotlin/style-guide).
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ Ktlint uses a limited set of `.editorconfig` properties for additional configura

## Code style

By default, the `intellij_idea` Kotlin code style is applied. Alternatively, the code style can be set to `ktlint_official` or `android`.
By default, the `ktlint_official` code style is applied. Alternatively, the code style can be set to `intellij_idea` or `android_studio`.

```ini
[*.{kt,kts}]
ktlint_code_style = ktlint_official
```

!!! note
The default code style will be changed to `ktlint_official` in the `1.0` version of ktlint.

## Disabled rules

Rule sets and individual rules can be disabled / enabled with a separate property per rule (set).
Expand Down
6 changes: 6 additions & 0 deletions documentation/release-latest/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@
<strong>Click here to go to latest.</strong>
</a>
{% endblock %}

<strong>The maven coordinates of `ktlint` have been changed. See
<a href="{{ '../' ~ base_url }}/1.0.0/faq/#what-are-the-maven-coordinates-in-ktlint-1x">
new Maven coordinates
</a>
</strong>
2 changes: 0 additions & 2 deletions documentation/snapshot/docs/install/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ ktlint installGitPrePushHook

### Miscellaneous flags and commands

`-a` or `--android`: Turn on Android Kotlin Style Guide compatibility. This flag is most likely to be removed in a future version. Use [`.editorconfig ktlint_code_style`](../../rules/configuration-ktlint/#code-style).

`--color` and `--color-name=<colorName>`: Make output colorful and optionally set the color name to use.

`--disabled_rules=<disabledRules>`: A comma-separated list of rules to globally disable. To disable the standard ktlint rule-set use `--disabled_rules=standard`. This flag is most likely to be removed in a future version. Use [`.editorconfig disabled_rules`](../../rules/configuration-ktlint/#disabled-rules).
Expand Down
12 changes: 5 additions & 7 deletions documentation/snapshot/docs/rules/code-styles.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
The code style `ktlint_official` is first introduced in version `0.49`. This code style is work in progress but will become the default code style in the `1.0` release. Please try out the new code style and provide your feedback via the [issue tracker](https://github.com/pinterest/ktlint/issues).
Starting from version `1.0`, `ktlint_official` is the default code style. If you want to revert to another code style, then set the `.editorconfig` property `ktlint_code_style`.

```ini
[*.{kt,kts}]
ktlint_code_style = ktlint_official
ktlint_code_style = intellij_idea # or android_studio or ktlint_official (default)
```

This `ktlint_official` code style combines the best elements from the [Kotlin Coding conventions](https://kotlinlang.org/docs/coding-conventions.html) and [Android's Kotlin styleguide](https://developer.android.com/kotlin/style-guide). This code style also provides additional formatting on topics which are not (explicitly) mentioned in those conventions and style guide.
The `ktlint_official` code style combines the best elements from the [Kotlin Coding conventions](https://kotlinlang.org/docs/coding-conventions.html) and [Android's Kotlin styleguide](https://developer.android.com/kotlin/style-guide). This code style also provides additional formatting on topics which are not (explicitly) mentioned in those conventions and style guide.

!!! note
Be aware that this code style in some cases formats code in a way which is not accepted by the default code formatters in IntelliJ IDEA and Android Studio. The formatters of those editors produce nicely formatted code in the vast majority of cases. But in a number of edge cases, the formatting contains bugs which are waiting to be fixed for several years. The new code style formats code in a way which is compatible with the default formatting of the editors whenever possible. When using this codestyle, it is best to disable (e.g. not use) code formatting in the editor.

The existing code styles have been renamed to make more clear what the basis of the code style is.
* The `intellij_idea` (formerly `official`) code style aims to be compatible with default formatter of IntelliJ IDEA. This code style is based on [Kotlin Coding conventions](https://kotlinlang.org/docs/coding-conventions.html).

* The `official` code style has been renamed to `intellij_idea`. Code formatted with this code style aims to be compatible with default formatter of IntelliJ IDEA. This code style is based on [Kotlin Coding conventions](https://kotlinlang.org/docs/coding-conventions.html). If `.editorconfig` property `ktlint_code_style` has been set to `official` then do not forget to change the value of that property to `intellij_idea`. When not set, this is the default code style. Be aware that the default code style will be changed to `ktlint_official` in the `1.0` release.

* Code style `android` has been renamed to `android_studio`. Code formatted with this code style aims to be compatible with default formatter of Android Studio. This code style is based on [Android's Kotlin styleguide](https://developer.android.com/kotlin/style-guide). If `.editorconfig` property `ktlint_code_style` has been set to `android` then do not forget to change the value of that property to `android_studio`.
* The `android_studio` (formerly `android`) aims to be compatible with default formatter of Android Studio. This code style is based on [Android's Kotlin styleguide](https://developer.android.com/kotlin/style-guide).
5 changes: 1 addition & 4 deletions documentation/snapshot/docs/rules/configuration-ktlint.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ Ktlint uses a limited set of `.editorconfig` properties for additional configura

## Code style

By default, the `intellij_idea` Kotlin code style is applied. Alternatively, the code style can be set to `ktlint_official` or `android`.
By default, the `ktlint_official` code style is applied. Alternatively, the code style can be set to `intellij_idea` or `android_studio`.

```ini
[*.{kt,kts}]
ktlint_code_style = ktlint_official
```

!!! note
The default code style will be changed to `ktlint_official` in the `1.0` version of ktlint.

## Disabled rules

Rule sets and individual rules can be disabled / enabled with a separate property per rule (set).
Expand Down

0 comments on commit 0b4c4f5

Please sign in to comment.