diff options
author | Tyson Henning <yorick@google.com> | 2018-01-19 16:15:55 -0800 |
---|---|---|
committer | Tyson Henning <yorick@google.com> | 2018-01-19 16:25:11 -0800 |
commit | e4158b37f3394e0398050be9e31d206063282bc6 (patch) | |
tree | ccc62cea92e9e13d496ff930d8266a8cc8e09be4 | |
parent | a6100281b01aaa767bbe56d9c6965036481602b8 (diff) | |
download | platform_prebuilts_ktlint-e4158b37f3394e0398050be9e31d206063282bc6.tar.gz platform_prebuilts_ktlint-e4158b37f3394e0398050be9e31d206063282bc6.tar.bz2 platform_prebuilts_ktlint-e4158b37f3394e0398050be9e31d206063282bc6.zip |
Modified kylint.py to pass along '-F' or '--format' to the underlyingandroid-9.0.0_r47android-9.0.0_r46android-9.0.0_r45android-9.0.0_r44android-9.0.0_r43android-9.0.0_r42android-9.0.0_r41android-9.0.0_r40android-9.0.0_r39android-9.0.0_r38android-9.0.0_r37android-9.0.0_r36android-9.0.0_r35android-9.0.0_r34android-9.0.0_r33android-9.0.0_r32android-9.0.0_r31android-9.0.0_r30android-9.0.0_r22android-9.0.0_r21android-9.0.0_r20android-9.0.0_r19android-9.0.0_r16android-9.0.0_r12android-9.0.0_r11pie-qpr3-s1-releasepie-qpr3-releasepie-qpr3-b-releasepie-qpr2-releasepie-qpr1-s3-releasepie-qpr1-s2-releasepie-qpr1-s1-releasepie-qpr1-releasepie-dr1-releasepie-dr1-devpie-devpie-b4s4-releasepie-b4s4-dev
binary. This allows for autoformatting.
Bug: n/a
Fixes: n/a
Test: Manual
Change-Id: Ia1dbbca8d09a8537632b93ccc9f1be9fab60cfd8
-rwxr-xr-x | ktlint.py | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -31,15 +31,20 @@ KTLINT_JAR = os.path.join(MAIN_DIRECTORY, 'ktlint-android-all.jar') def main(args=None): parser = argparse.ArgumentParser() parser.add_argument('--file', '-f', nargs='*') + parser.add_argument('--format', '-F', dest='format', action='store_true') + parser.add_argument('--noformat', dest='format', action='store_false') + parser.set_defaults(format=False) args = parser.parse_args() - kotlin_files = [f for f in args.file if f.endswith('.kt')] - if not kotlin_files: + ktlint_args = [f for f in args.file if f.endswith('.kt')] + if args.format: + ktlint_args += ['-F'] + if not ktlint_args: sys.exit(0) ktlint_env = os.environ.copy() ktlint_env['JAVA_CMD'] = 'java' try: - check = subprocess.Popen(['java', '-jar', KTLINT_JAR] + kotlin_files, + check = subprocess.Popen(['java', '-jar', KTLINT_JAR] + ktlint_args, stdout=subprocess.PIPE, env=ktlint_env) stdout, _ = check.communicate() if stdout: |