Use ag to find TODOs
This commit is contained in:
parent
1b7a8d0dbd
commit
312976f56b
@ -1,6 +1,8 @@
|
||||
#!/bin/zsh
|
||||
# The return code
|
||||
local ERR=0
|
||||
# Format all c files
|
||||
GLOB=( **/*.c )
|
||||
local GLOB=( **/*.c )
|
||||
# Astyle options:
|
||||
# --mode=c : c formatting
|
||||
# -xc : Brace attached to class names
|
||||
@ -16,7 +18,7 @@ GLOB=( **/*.c )
|
||||
# -n : Don't make a backup
|
||||
# -p : Pad operators
|
||||
# -H : Pad header (space after if, for, while)
|
||||
OPTS=( --mode=c -xc --style=stroustrup -j -s2 -xG -S -K -N -xn -xl -n -p -H )
|
||||
local OPTS=( --mode=c -xc --style=stroustrup -j -s2 -xG -S -K -N -xn -xl -n -p -H )
|
||||
# Process the c files by adding the comment and removing newlines
|
||||
perl "${0:h}/process.pl" $GLOB
|
||||
# Colorize output if you can
|
||||
@ -25,6 +27,10 @@ if which colout>/dev/null; then
|
||||
else
|
||||
astyle $OPTS $GLOB|\grep -P '^(?!Unchanged)'||true
|
||||
fi
|
||||
# Check for todos
|
||||
if command -v ag >/dev/null; then
|
||||
ag TODO >&2 && ERR=2
|
||||
fi
|
||||
# Now check for documentation
|
||||
# Run doxygen, redirecting stdout to dev null, and setting stderr to $OUTPUT
|
||||
if command -v doxygen >/dev/null; then
|
||||
@ -34,8 +40,9 @@ if command -v doxygen >/dev/null; then
|
||||
# If there is output, something went wrong
|
||||
if [ ! -z "$OUTPUT" ]; then
|
||||
printf "$OUTPUT\n" >&2
|
||||
return 2
|
||||
ERR=3
|
||||
fi
|
||||
else
|
||||
printf "You don't have doxygen installed. Can't check documentation\n" >&2
|
||||
fi
|
||||
return "$ERR"
|
||||
|
Loading…
Reference in New Issue
Block a user