diff options
author | Aurimas Liutikas <aurimas@google.com> | 2018-07-11 19:37:26 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-07-11 19:37:26 -0700 |
commit | 6a8a1507117d60ac2c8706c875236d9c868fd332 (patch) | |
tree | ab623cd6b323db4baf0c194170eb5c441741026b | |
parent | e4158b37f3394e0398050be9e31d206063282bc6 (diff) | |
parent | 8e55ec3c1e36c1b16758f3b7ea9429851b630e3b (diff) | |
download | ktlint-6a8a1507117d60ac2c8706c875236d9c868fd332.tar.gz |
Print message to format if any errors are found. am: 68e5195bb7
am: 8e55ec3c1e
Change-Id: I8fdb7745081e705150f71a747b77c04a5b72ed1f
-rwxr-xr-x | ktlint.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -26,6 +26,12 @@ import sys MAIN_DIRECTORY = os.path.normpath(os.path.dirname(__file__)) KTLINT_JAR = os.path.join(MAIN_DIRECTORY, 'ktlint-android-all.jar') +FORMAT_MESSAGE = ''' +********************************************************************** +To format run: +{}/ktlint.py --format --file {} +********************************************************************** +''' def main(args=None): @@ -35,7 +41,8 @@ def main(args=None): parser.add_argument('--noformat', dest='format', action='store_false') parser.set_defaults(format=False) args = parser.parse_args() - ktlint_args = [f for f in args.file if f.endswith('.kt')] + kt_files = [f for f in args.file if f.endswith('.kt') or f.endswith('.kts')] + ktlint_args = kt_files[:] if args.format: ktlint_args += ['-F'] if not ktlint_args: @@ -50,6 +57,7 @@ def main(args=None): if stdout: print 'prebuilts/ktlint found errors in files you changed:' print stdout + print FORMAT_MESSAGE.format(MAIN_DIRECTORY, ' '.join(kt_files)) sys.exit(1) else: sys.exit(0) |