Permalink
Browse files

Merge branch 'tcm-marcel-cleanup/formatter_fix'

  • Loading branch information...
apavlo committed Jan 12, 2018
2 parents fa7a119 + db387ff commit 036b6d4db5365604284f70fba68a5e801fa10a97
Showing with 14 additions and 4 deletions.
  1. +8 −3 script/formatting/formatter.py
  2. +6 −1 script/git-hooks/pre-commit
@@ -33,6 +33,7 @@
DEFAULT_DIRS.append(PELOTON_TESTS_DIR)
CLANG_FORMAT = "clang-format-3.6"
CLANG_FORMAT_FILE = os.path.join(PELOTON_DIR, ".clang-format")
## ==============================================
## HEADER CONFIGURATION
@@ -111,9 +112,13 @@ def format_file(file_path, update_header, clang_format_code):
fd.write(file_data)
elif clang_format_code:
formatting_command = CLANG_FORMAT + " -style=file " + " -i " + file_path
LOG.info(formatting_command)
subprocess.call([CLANG_FORMAT, "-style=file", "-i", file_path])
try:
formatting_command = CLANG_FORMAT + " -style=file -i " + file_path
LOG.info(formatting_command)
subprocess.call([CLANG_FORMAT, "-style=file", "-i", file_path])
except OSError as e:
LOG.error("clang-format seems not installed")
exit("clang-format seems not installed")
#END WITH
@@ -13,7 +13,12 @@ if [ -n "$files" ]; then
python script/validators/source_validator.py --files $files
result=$?
if [ $result -ne 0 ]; then
echo "Use './script/formatter/formatter.py -c -f' to format all staged files or '--no-verify' to temporarily bypass the pre-commit hook. Be aware that changed files have to be staged again!"
echo "*******************************"
echo "*** Peloton Pre-Commit Hook ***"
echo "*******************************"
echo "Use \"./script/formatting/formatter.py -c -f\" to format all staged files or \"--no-verify\" to temporarily bypass the pre-commit hook."
echo "Be aware that changed files have to be staged again!"
echo "*******************************"
fi
exit $result
fi

0 comments on commit 036b6d4

Please sign in to comment.