From de088d407c7ca6bb682527e8e802242668813ed4 Mon Sep 17 00:00:00 2001 From: Jordan Demeulenaere Date: Fri, 10 Jun 2022 11:53:14 +0200 Subject: 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 --- ktlint.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ktlint.py') 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: -- cgit v1.2.3