From eb51de65e5f8b5c724b54d9965b1976ae53c2266 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 24 May 2016 22:16:53 -0700 Subject: [PATCH] format.py: Error out if no files found to format. (#56) This can happen if the script is run from a directory other than the project root or styleguide. --- styleguide/format.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/styleguide/format.py b/styleguide/format.py index 27e0f0b1bf..1b65cb5a47 100755 --- a/styleguide/format.py +++ b/styleguide/format.py @@ -42,6 +42,10 @@ clangExec = "clang-format" if sys.platform.startswith("win32"): clangExec += ".exe" +if not files: + print("Error: no files found to format", file=sys.stderr) + sys.exit(1) + for name in files: # List names of files as they are processed if verbose flag was given if len(sys.argv) > 1 and sys.argv[1] == "-v":