diff options
author | Simon Wingrove <simonjw@google.com> | 2022-12-20 09:34:15 +0000 |
---|---|---|
committer | Simon Wingrove <simonjw@google.com> | 2022-12-20 09:34:15 +0000 |
commit | f32bd8e7cb130225464f031cf71935e6de31bf2c (patch) | |
tree | a602485dd8e8fac3c0f8730bc30a49ede27d307c | |
parent | 76c41274ea445de34833d1a2f90e51ac22c485b2 (diff) | |
download | ktlint-f32bd8e7cb130225464f031cf71935e6de31bf2c.tar.gz |
Allow custom editorconfig if needed
Allows preupload config to customize the editorconfig, or remove it in
favor of directoy-specific ones, if desired.
Test: manually
Bug: 261139484
Change-Id: Ia4dbbf7dee4f96e5dcfd496cc79e73ae66f661f5
-rwxr-xr-x | ktlint.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -43,6 +43,7 @@ def main(args=None): parser.add_argument('--format', '-F', dest='format', action='store_true') parser.add_argument('--noformat', dest='format', action='store_false') parser.add_argument('--no-verify-format', dest='verify_format', action='store_false') + parser.add_argument('--editorconfig', default=EDITOR_CONFIG) parser.set_defaults(format=False, verify_format=True) args = parser.parse_args() kt_files = [f for f in args.file if f.endswith('.kt') or f.endswith('.kts')] @@ -57,9 +58,12 @@ def main(args=None): disabled_rules += ['final-newline', 'no-consecutive-blank-lines', 'import-ordering'] ktlint_args = kt_files[:] - ktlint_args += ['--editorconfig', EDITOR_CONFIG] ktlint_args += ['--disabled_rules=' + ','.join(disabled_rules)] + # Setup editor config explicitly if defined - else will inherit from tree + if args.editorconfig is not None: + ktlint_args += ['--editorconfig', args.editorconfig] + # Automatically format files if requested. if args.format: ktlint_args += ['-F'] |