Skip to content
Snippets Groups Projects
Commit 84e5a492 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

[hooks.pre-commit] give a more meaningfull error message

parent bbb42851
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,14 @@ def check_file(touched_file, basedir, format_binary, extension_whitelist=CPP_EXT
if __name__ == '__main__':
dirname = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else os.getcwd())
fails = check_dir(dirname, mode='staged')
try:
fails = check_dir(dirname, mode='staged')
except FileNotFoundError as err:
raise RuntimeError("""If you have trouble with clang-format, you can specify which version to use with
git config hooks.clangformat clang-format
The original error was: {}""".format(err))
if len(fails) > 0:
print('files need to be formatted:\n\t{}'.format('\n\t'.join(fails)) )
sys.exit(len(fails))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment