From bb9107bac013331ceb59794e26b71ac43f3e083a Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 28 Oct 2019 17:38:21 -0700 Subject: [PATCH] Fix the dry run mode of the GN format checker script --- ci/check_gn_format.py | 7 +++---- ci/format.sh | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ci/check_gn_format.py b/ci/check_gn_format.py index 5cc889c808aa8..d7611a4f91415 100755 --- a/ci/check_gn_format.py +++ b/ci/check_gn_format.py @@ -25,7 +25,7 @@ def main(): parser = argparse.ArgumentParser(); parser.add_argument('--gn-binary', dest='gn_binary', required=True, type=str) - parser.add_argument('--dry-run', dest='dry_run', default=True, type=str) + parser.add_argument('--dry-run', dest='dry_run', default=False, action='store_true') parser.add_argument('--root-directory', dest='root_directory', required=True, type=str) args = parser.parse_args() @@ -35,16 +35,15 @@ def main(): gn_command = [ gn_binary, 'format'] - if args.dry_run == 'false': + if args.dry_run: gn_command.append('--dry-run') - for gn_file in GetGNFiles(args.root_directory): if subprocess.call(gn_command + [ gn_file ]) != 0: print "ERROR: '%s' is incorrectly formatted." % os.path.relpath(gn_file, args.root_directory) print "Format the same with 'gn format' using the 'gn' binary in //buildtools." print "Or, run ./ci/check_gn_format.py with '--dry-run false'" - return -1 + return 1 return 0 diff --git a/ci/format.sh b/ci/format.sh index ceacb5af07938..bff94d77b07dd 100755 --- a/ci/format.sh +++ b/ci/format.sh @@ -75,4 +75,4 @@ if [[ ! -z "$TRAILING_SPACES" ]]; then fi # Check GN format consistency -./ci/check_gn_format.py --dry-run true --root-directory . --gn-binary "third_party/gn/gn" +./ci/check_gn_format.py --dry-run --root-directory . --gn-binary "third_party/gn/gn"