Added check to make sure that logging is used over print
This commit is contained in:
@@ -22,6 +22,7 @@ lint:
|
|||||||
- pipenv run python setup.py check -mrs
|
- pipenv run python setup.py check -mrs
|
||||||
- pipenv run flake8
|
- pipenv run flake8
|
||||||
- pipenv run mypy sublime
|
- pipenv run mypy sublime
|
||||||
|
- ./cicd/no_print.sh
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
|
11
cicd/no_print.sh
Executable file
11
cicd/no_print.sh
Executable 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
|
@@ -32,7 +32,7 @@ def main():
|
|||||||
|
|
||||||
args, unknown_args = parser.parse_known_args()
|
args, unknown_args = parser.parse_known_args()
|
||||||
if args.version:
|
if args.version:
|
||||||
print(f'Sublime Music v{sublime.__version__}')
|
print(f'Sublime Music v{sublime.__version__}') # allowprint
|
||||||
return
|
return
|
||||||
|
|
||||||
min_log_level = getattr(logging, args.loglevel.upper(), None)
|
min_log_level = getattr(logging, args.loglevel.upper(), None)
|
||||||
|
Reference in New Issue
Block a user