Skip to content

Commit

Permalink
Update Ktlint to v1.1.0 (#5431)
Browse files Browse the repository at this point in the history
  • Loading branch information
FloEdelmann authored Jan 2, 2024
1 parent d47e7a9 commit e366b2c
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 9 deletions.
42 changes: 41 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,47 @@ indent_style = tab
[*.{kt,kts}]
indent_style = space
indent_size = 4
disabled_rules = annotation,argument-list-wrapping,chain-wrapping,filename,indent,no-empty-first-line-in-method-block,no-multi-spaces,package-name,paren-spacing,spacing-between-declarations-with-annotations,spacing-between-declarations-with-comments,trailing-comma,wrapping,no-wildcard-imports

# disable Ktlint rules that are too strict for this project
ktlint_standard_annotation = disabled
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_block-comment-initial-star-alignment = disabled
ktlint_standard_chain-wrapping = disabled
ktlint_standard_comment-wrapping = disabled
ktlint_standard_enum-wrapping = disabled
ktlint_standard_filename = disabled
ktlint_standard_function-naming = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_if-else-bracing = disabled
ktlint_standard_if-else-wrapping = disabled
ktlint_standard_indent = disabled
ktlint_standard_max-line-length = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_multiline-if-else = disabled
ktlint_standard_no-blank-line-in-list = disabled
ktlint_standard_no-consecutive-comments = disabled
ktlint_standard_no-empty-file = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_no-empty-first-line-in-method-block = disabled
ktlint_standard_no-multi-spaces = disabled
ktlint_standard_no-single-line-block-comment = disabled
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_package-name = disabled
ktlint_standard_parameter-list-wrapping = disabled
ktlint_standard_paren-spacing = disabled
ktlint_standard_property-naming = disabled
ktlint_standard_property-wrapping = disabled
ktlint_standard_spacing-between-declarations-with-annotations = disabled
ktlint_standard_spacing-between-declarations-with-comments = disabled
ktlint_standard_statement-wrapping = disabled
ktlint_standard_string-template-indent = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_try-catch-finally-spacing = disabled
ktlint_standard_value-argument-comment = disabled
ktlint_standard_value-parameter-comment = disabled
ktlint_standard_wrapping = disabled

[gradlew]
indent_style = space
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
id: ktlint-check
uses: musichin/ktlint-check@v1.2.1
with:
version: '0.46.0'
version: '1.1.0'
reporter: plain?group_by_file,output=${{ env.lintResultFilename }}
relative: true
verbose: true
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ See also [this far more detailed guide to making a new quest](CONTRIBUTING_A_NEW

Inheritance and class hierarchy should be avoided if possible. It is preferable to extract shared code to helper file such as [KerbUtil.kt](app/src/main/java/de/westnordost/streetcomplete/osm/kerb/KerbUtil.kt).

It is recommended to install the [Ktlint (unofficial)](https://plugins.jetbrains.com/plugin/15057-ktlint-unofficial-) Android Studio plugin which highlights lint issues (e.g. inconsistent spacing) directly inline while writing code.
It is recommended to install the [*Ktlint* Android Studio plugin](https://plugins.jetbrains.com/plugin/15057-ktlint) which highlights lint issues (e.g. inconsistent spacing) directly inline while writing code.

### Hints for more active people

Expand Down Expand Up @@ -143,4 +143,3 @@ Materials in [`res/documentation`](res/documentation) also may be useful, it inc
* [StreetComplete-taginfo-categorize](https://github.com/mnalis/StreetComplete-taginfo-categorize) by [@mnalis](https://github.com/mnalis) generates tags listed in [KEYS_THAT_SHOULD_BE_REMOVED_WHEN_SHOP_IS_REPLACED](https://github.com/streetcomplete/StreetComplete/blob/master/app/src/main/java/de/westnordost/streetcomplete/osm/Shop.kt#L6)

You may find more projects under [the StreetComplete tag](https://github.com/topics/streetcomplete) on GitHub.

2 changes: 1 addition & 1 deletion app/src/main/java/de/westnordost/streetcomplete/Prefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ object Prefs {
LIGHT(AppCompatDelegate.MODE_NIGHT_NO),
DARK(AppCompatDelegate.MODE_NIGHT_YES),
AUTO(AppCompatDelegate.MODE_NIGHT_AUTO),
SYSTEM(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
SYSTEM(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
}

enum class ResurveyIntervals {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fun updateCommonSurfaceFromFootAndCyclewaySurface(tags: Tags) {
}
}

private fun getCommonSurface(vararg surface: String?): String? = when {
private fun getCommonSurface(vararg surface: String?): String? = when {
surface.any { it == null } -> null
surface.all { it == surface.firstOrNull() } -> surface.firstOrNull()
surface.all { it in ANYTHING_PAVED } -> "paved"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import de.westnordost.streetcomplete.osm.LengthInFeetAndInches
import de.westnordost.streetcomplete.osm.LengthInMeters

class MeasureContract : ActivityResultContract<MeasureContract.Params, Length?>() {
data class Params(val lengthUnit: LengthUnit, val measureVertical: Boolean, )
data class Params(val lengthUnit: LengthUnit, val measureVertical: Boolean)

override fun createIntent(context: Context, input: Params): Intent {
val unit = when (input.lengthUnit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
prefs.putInt(Prefs.LAST_SHOWN_USER_GLOBAL_RANK_CURRENT_WEEK, rankCurrentWeek)
}

private fun updateGlobalRankText(rank: Int, previousRank: Int, container: View, circle: TextView ) {
private fun updateGlobalRankText(rank: Int, previousRank: Int, container: View, circle: TextView) {
val shouldHide = rank <= 0 || statisticsSource.getEditCount() <= 100
container.isGone = shouldHide
if (shouldHide) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GroupedImageSelectAdapter<T> :
selectedItem?.let { indexOfItemGivenGroupMembership(it, selectedItemGroup) } ?: -1

private fun indexOfItemGivenGroupMembership(item: GroupableDisplayItem<T>, group: GroupableDisplayItem<T>?): Int {
var currentGroup: GroupableDisplayItem<T> ? = null
var currentGroup: GroupableDisplayItem<T>? = null
for (i in 0 until _items.size) {
if (_items[i].isGroup) {
currentGroup = _items[i]
Expand Down

0 comments on commit e366b2c

Please sign in to comment.