summaryrefslogtreecommitdiff
path: root/ktlint.py
diff options
context:
space:
mode:
authorJordan Demeulenaere <jdemeulenaere@google.com>2022-06-10 11:53:14 +0200
committerJordan Demeulenaere <jdemeulenaere@google.com>2022-06-10 10:01:38 +0000
commitde088d407c7ca6bb682527e8e802242668813ed4 (patch)
treed5f6623e19d9debd425b200c2465f4a652cc1e8d /ktlint.py
parent1aaf3e4b038980ba4bbe7e08f42aa6949bb1836d (diff)
downloadktlint-de088d407c7ca6bb682527e8e802242668813ed4.tar.gz
Configure ktlint the same way as google3 does
Given that we are going to use ktfmt to format our files and that ktlint and ktfmt don't agree on indentation rules, let's configure ktlint to disable rules that clash with ktfmt. The configuration is the same as in google3 [1] with those additional changes: * Indentation is set to 4. * wrapping rule is disabled. This is not disabled in google3 yet because this rules is causing issue starting from release 0.45 and google3 is on 0.43 (while we are on 0.46/master). [1] http://google3/third_party/kotlin/ktlint/.editorconfig Bug: 235461679 Test: Manual Change-Id: I851e511db06ae38ea89be0f90a86746a1fa92dac
Diffstat (limited to 'ktlint.py')
-rwxr-xr-xktlint.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ktlint.py b/ktlint.py
index 16bc0f8..80703a4 100755
--- a/ktlint.py
+++ b/ktlint.py
@@ -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:
@@ -45,6 +46,7 @@ def main(args=None):
args = parser.parse_args()
kt_files = [f for f in args.file if f.endswith('.kt') or f.endswith('.kts')]
ktlint_args = kt_files[:]
+ ktlint_args += ['--editorconfig', EDITOR_CONFIG]
if args.format:
ktlint_args += ['-F']
if not ktlint_args: