Skip to content

Commit

Permalink
Skip reformatting if black or clang-format are not installed
Browse files Browse the repository at this point in the history
When using "make reformat".
  • Loading branch information
Julien-Elie committed Nov 20, 2021
1 parent 6b45424 commit ef377a5
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Makefile
Expand Up @@ -260,7 +260,17 @@ snapshot:
## extension), but it should be manually handled as it contains mixed yacc
## code.
reformat:
black --line-length 79 --quiet --experimental-string-processing \
--include "contrib/mm_ckpasswd|\.py$$" .
find . -name '*.[ch]' \! -name config_l.c \! -name config_y.\* -print \
| xargs clang-format --style=file -i
@if command -v "black" &> /dev/null ; then \
echo "Reformatting Python code..." ; \
black --line-length 79 --quiet --experimental-string-processing \
--include "contrib/mm_ckpasswd|\.py$$" . ; \
else \
echo "Skipping Python code reformatting (black not found)" ; \
fi
@if command -v "clang-format" &> /dev/null ; then \
echo "Reformatting C code..." ; \
find . -name '*.[ch]' \! -name config_l.c \! -name config_y.\* \
-print | xargs clang-format --style=file -i ; \
else \
echo "Skipping C code reformatting (clang-format not found)" ; \
fi

0 comments on commit ef377a5

Please sign in to comment.