-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7640a1
commit 54bc525
Showing
2 changed files
with
33 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
# required in order to get the status of all the files at once | ||
err=0 | ||
trap 'err=1' ERR | ||
pip install darglint==1.6.0 | ||
pip install pydocstyle==5.1.1 | ||
echo ==================================================================================== | ||
echo DOCSTRINGS LINT: checking $CHANGED_FILES | ||
echo ------------------------------------------------------------------------------------ | ||
echo 'removing files under /tests...' | ||
arrVar=() | ||
# we ignore tests files | ||
for changed_file in $CHANGED_FILES; do | ||
if [[ ${changed_file}} != tests/* ]]; then | ||
echo keeping ${changed_file} | ||
arrVar+=(${changed_file}) | ||
fi | ||
done | ||
DARGLINT_OUTPUT=$(darglint -v 2 -s sphinx "${arrVar[@]}"); PYDOCSTYLE_OUTPUT=$(pydocstyle --select=D101,D102,D103 "${arrVar[@]}") | ||
# status captured here | ||
if [[ -z "$PYDOCSTYLE_OUTPUT" ]] && [[ -z "$DARGLINT_OUTPUT" ]]; then | ||
echo 'OK' | ||
exit 0 | ||
else | ||
echo 'failure' | ||
echo $DARGLINT_OUTPUT | ||
echo $PYDOCSTYLE_OUTPUT | ||
exit 1 | ||
fi | ||
echo ==================================================================================== |