From 72d3f1e90985260625e493579a4a9e47022238d2 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 9 Oct 2019 15:06:02 +0200 Subject: [PATCH] Configure ktlint --- .buildkite/pipeline.yml | 5 ++++- .editorconfig | 30 ++++++++++++++++++++++++++++++ .gitignore | 2 ++ CONTRIBUTING.md | 9 +++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .editorconfig diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index e60595e8b9..fb2c36743d 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -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" diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..190985981f --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.gitignore b/.gitignore index 0722110715..26ee897e5e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ .externalNativeBuild /tmp + +ktlint diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 449f6421cf..0c1fd13d74 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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