diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-11 03:28:32 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-06-11 03:28:32 +0000 |
commit | 529112ae1dc611c34fcf68e93d8f6fa98f37c203 (patch) | |
tree | dffdf7e0d49949b39f154d2070eefb7bce140ad6 | |
parent | fe653bd4f4bf1b4c0988791ffa654aa64a48025b (diff) | |
parent | 4149cdeb0128facacfb2d09ddcfa0661259c177f (diff) | |
download | ktlint-android-13.0.0_r28.tar.gz |
Snap for 8710680 from 4149cdeb0128facacfb2d09ddcfa0661259c177f to tm-qpr1-releaseandroid-13.0.0_r30android-13.0.0_r29android-13.0.0_r28android-13.0.0_r27android-13.0.0_r24android-13.0.0_r23android-13.0.0_r22android-13.0.0_r21android-13.0.0_r20android-13.0.0_r19android-13.0.0_r18android-13.0.0_r17android-13.0.0_r16android13-qpr1-s8-releaseandroid13-qpr1-s7-releaseandroid13-qpr1-s6-releaseandroid13-qpr1-s5-releaseandroid13-qpr1-s4-releaseandroid13-qpr1-s3-releaseandroid13-qpr1-s2-releaseandroid13-qpr1-s1-releaseandroid13-qpr1-release
Change-Id: Ied8bb8df90fed810f8c7ff8d86a1a8a1143f0833
-rw-r--r-- | .editorconfig | 12 | ||||
-rwxr-xr-x | ktlint.py | 7 |
2 files changed, 17 insertions, 2 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e97aa07 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +[*.{kt,kts}] +indent_size = 4 +max_line_length = 100 +trim_trailing_whitespace = true +insert_final_newline = true +ij_kotlin_imports_layout=* + +# Comma-separated list of rules to disable +# ktlint disagrees on indentation with ktfmt in some cases +# TODO(b/185904220): paren spacing disabled because of a ktfmt bug +# TODO(b/189506168): curly spacing disabled because of a ktfmt bug +disabled_rules=indent,paren-spacing,curly-spacing,wrapping @@ -28,6 +28,7 @@ import sys MAIN_DIRECTORY = os.path.normpath(os.path.dirname(__file__)) KTLINT_JAR = os.path.join(MAIN_DIRECTORY, 'ktlint-android-all.jar') +EDITOR_CONFIG = os.path.join(MAIN_DIRECTORY, '.editorconfig') FORMAT_MESSAGE = ''' ********************************************************************** To format run: @@ -44,11 +45,13 @@ def main(args=None): parser.set_defaults(format=False) args = parser.parse_args() kt_files = [f for f in args.file if f.endswith('.kt') or f.endswith('.kts')] + if not kt_files: + sys.exit(0) + ktlint_args = kt_files[:] + ktlint_args += ['--editorconfig', EDITOR_CONFIG] if args.format: ktlint_args += ['-F'] - if not ktlint_args: - sys.exit(0) ktlint_args += ['--android'] |