diff options
author | Jordan Demeulenaere <jdemeulenaere@google.com> | 2022-06-10 16:24:30 +0200 |
---|---|---|
committer | Jordan Demeulenaere <jdemeulenaere@google.com> | 2022-06-10 14:26:55 +0000 |
commit | 4149cdeb0128facacfb2d09ddcfa0661259c177f (patch) | |
tree | dffdf7e0d49949b39f154d2070eefb7bce140ad6 | |
parent | de088d407c7ca6bb682527e8e802242668813ed4 (diff) | |
download | ktlint-4149cdeb0128facacfb2d09ddcfa0661259c177f.tar.gz |
Fix ktlint hook
In ag/18798895, I broke the early exit condition when the ktlint hook
would receive 0 Kotlin files. Since that CL, ktlint would always run on
a big number of files if th CL didn't contain any change in a .kt or
.kts file.
Bug: 235461679
Test: Manual
Change-Id: Iaf21df8e85943229c1d832b186825b41cf231b2d
-rwxr-xr-x | ktlint.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -45,12 +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'] |