Compare commits

...

3 Commits

Author SHA1 Message Date
Andrew Morgan e51baaef01 Clearer help text 2020-10-12 10:19:27 +01:00
Andrew Morgan 16c2f54618 feature -> misc 2020-10-12 10:18:38 +01:00
Andrew Morgan 06226ef953 Print and exit if no changed files were found while using -d 2020-10-12 10:17:41 +01:00
2 changed files with 15 additions and 6 deletions

View File

@ -19,7 +19,7 @@ usage() {
echo echo
echo " If no paths are provided and this option is not set, all files will be linted." echo " If no paths are provided and this option is not set, all files will be linted."
echo echo
echo " Note that paths will be excluded if they both have a file extension, and it is not 'py'." echo " Note that paths with a file extension that is not '.py' will be excluded."
echo "-h" echo "-h"
echo " Display this help text." echo " Display this help text."
} }
@ -66,11 +66,20 @@ shift "$((OPTIND-1))"
# Append any remaining arguments as files to lint # Append any remaining arguments as files to lint
files+=("$@") files+=("$@")
# If we were not asked to lint changed files, and no paths were found as a result, if [[ $USING_DIFF -eq 1 ]]; then
# then lint everything! # If we were asked to lint changed files, and no paths were found as a result...
if [[ $USING_DIFF -eq 0 && -z ${files+x} ]]; then if [ ${#files[@]} -eq 0 ]; then
# Lint all source code files and directories # Then print and exit
files=("synapse" "tests" "scripts-dev" "scripts" "contrib" "synctl") echo "No files found to lint."
exit 0
fi
else
# If we were not asked to lint changed files, and no paths were found as a result,
# then lint everything!
if [[ -z ${files+x} ]]; then
# Lint all source code files and directories
files=("synapse" "tests" "scripts-dev" "scripts" "contrib" "synctl")
fi
fi fi
echo "Linting these paths: ${files[*]}" echo "Linting these paths: ${files[*]}"