Added check to make sure that logging is used over print

This commit is contained in:
Sumner Evans
2020-01-20 14:49:12 -07:00
parent 072a8319b4
commit 842609c0ff
3 changed files with 13 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ lint:
- pipenv run python setup.py check -mrs
- pipenv run flake8
- pipenv run mypy sublime
- ./cicd/no_print.sh
test:
stage: test

11
cicd/no_print.sh Executable file
View File

@@ -0,0 +1,11 @@
#! /bin/bash
grep -Inre "print(" sublime | while read line; do
if [[ $line =~ "# allowprint" ]]; then
continue
fi
echo "Found instance of print statement:"
echo $line
echo "Use logging instead or add '# allowprint' to the end of the line."
exit 1
done

View File

@@ -32,7 +32,7 @@ def main():
args, unknown_args = parser.parse_known_args()
if args.version:
print(f'Sublime Music v{sublime.__version__}')
print(f'Sublime Music v{sublime.__version__}') # allowprint
return
min_log_level = getattr(logging, args.loglevel.upper(), None)