Configure ktlint

This commit is contained in:
Benoit Marty 2019-10-09 15:06:02 +02:00
parent 255fa11e89
commit 72d3f1e909
4 changed files with 45 additions and 1 deletions

View File

@ -54,4 +54,7 @@ steps:
# Code quality
- label: "Code quality"
command: "./tools/check/check_code_quality.sh"
command:
- "./tools/check/check_code_quality.sh"
- "curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.34.2/ktlint && chmod a+x ktlint"
- "./ktlint --android -v"

30
.editorconfig Normal file
View File

@ -0,0 +1,30 @@
# For ktlint configuration. Ref: https://ktlint.github.io/
[*.{kt,kts}]
# possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)
indent_size=unset
# true (recommended) / false
insert_final_newline=true
# possible values: number (e.g. 120) (package name, imports & comments are ignored), "off"
# it's automatically set to 100 on `ktlint --android ...` (per Android Kotlin Style Guide)
max_line_length=off
# Comma-separated list of rules to disable (Since 0.34.0)
# Note that rules in any ruleset other than the standard ruleset will need to be prefixed
# by the ruleset identifier.
disabled_rules=no-wildcard-imports,no-multi-spaces,colon-spacing,chain-wrapping,import-ordering
# The following (so far identified) rules are kept:
# no-blank-line-before-rbrace
# final-newline
# no-consecutive-blank-lines
# comment-spacing
# filename
# comma-spacing
# paren-spacing
# op-spacing
# string-template
# no-unused-imports
# curly-spacing
# no-semi
# no-empty-class-body

2
.gitignore vendored
View File

@ -12,3 +12,5 @@
.externalNativeBuild
/tmp
ktlint

View File

@ -42,6 +42,15 @@ Make sure the following commands execute without any error:
> ./tools/check/check_code_quality.sh
> curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.34.2/ktlint && chmod a+x ktlint
> ./ktlint --android -v
Note that you can run
> ./ktlint --android -v -F
For ktlint to fix some detected errors for you
> ./gradlew lintGplayRelease
### Unit tests