forked from mit-dci/opencbdc-tx
-
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.
added standalone pylint.sh script; improved install-build-tools.sh ov…
…er prev commit Signed-off-by: Morgan Rockett <[email protected]>
- Loading branch information
Showing
5 changed files
with
190 additions
and
63 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 |
---|---|---|
|
@@ -47,7 +47,6 @@ ethash*/ | |
lua-*/ | ||
benchmark-results/ | ||
CMakeFiles/ | ||
Python-*/ | ||
plots/ | ||
.deps/ | ||
.libs/ | ||
|
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
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,36 @@ | ||
#!/bin/bash | ||
|
||
# depedenent on 'sudo scripts/install-build-tools.sh' to install pylint | ||
if ! command -v pylint &>/dev/null; then | ||
echo "pylint is not installed." | ||
echo "Run 'sudo ./scripts/install-build-tools.sh' to install pylint." | ||
exit 1; | ||
fi | ||
|
||
MIN_CODE_QUALITY=8.0 | ||
if [ -n "$1" ]; then | ||
# set minimum quality to user input (int/float) if provided and (5.0 <= input <= 10.0) | ||
if [[ $1 =~ ^[0-9]*([\.][0-9])?$ ]]; then | ||
if (( $(echo "$1 >= 5.0" | bc -l) )) && (( $(echo "$1 <= 10.0" | bc -l) )); then | ||
MIN_CODE_QUALITY=$1 | ||
else | ||
# In the future, we want code quality to be at minimum 8.0/10.0 | ||
echo "Code quality score must be between 5.0 and 10.0, inclusive." | ||
echo "Recommended code quality score is >= 8.0." | ||
exit 1 | ||
fi | ||
else | ||
echo "Code quality score must be an integer or floating point number." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
echo "Linting Python code with minimum quality of $MIN_CODE_QUALITY/10.0..." | ||
pylint --rcfile=.pylintrc --fail-under=$MIN_CODE_QUALITY $(git ls-files '*.py') | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Linting failed, please fix the issues above." | ||
exit 1 | ||
else | ||
echo "Linting passed." | ||
fi |