forked from the-ethan-hunt/B.E.N.J.I.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/the-ethan-hunt/B.E.N.J.I.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
directories="linux MacOS windows" | ||
pass=0 | ||
fail=0 | ||
|
||
function prepare_venv() { | ||
VIRTUALENV=$(which venv) | ||
if [ $? -eq 1 ]; then | ||
|
||
VIRTUALENV=$(which venv-3) | ||
fi | ||
|
||
${VIRTUALENV} python3 -m venv mybenjienv && source mybenjienv/bin/activate && python3 "$(which pip3)" install pycodestyle | ||
} | ||
|
||
|
||
echo "----------------------------------------------------" | ||
echo "Running Python Linter against following directories:" | ||
echo "$directories" | ||
echo "----------------------------------------------------" | ||
echo | ||
|
||
[ "$NOVENV" == "1" ] || prepare_venv || exit 1 | ||
|
||
# checks for the whole directories | ||
for directory in $directories | ||
do | ||
files=$(find "$directory" -path "$directory/venv" -prune -o -name '*.py' -print) | ||
|
||
for source in $files | ||
do | ||
echo "$source" | ||
pycodestyle "$source" | ||
if [ $? -eq 0 ] | ||
then | ||
echo " Pass" | ||
let "pass++" | ||
else | ||
echo " Fail" | ||
let "fail++" | ||
fi | ||
done | ||
done | ||
|
||
$(deactivate && rm -rf mybenjienv/) | ||
|
||
if [ $fail -eq 0 ] | ||
then | ||
echo "All checks passed for $pass source files" | ||
else | ||
let total=$pass+$fail | ||
echo "Linter fail, $fail source files out of $total source files need to be fixed" | ||
exit 1 | ||
fi |
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,3 @@ | ||
[pycodestyle] | ||
ignore = W504 | ||
max-line-length = 80 |