Skip to content

Commit 0e2c7c7

Browse files
authored
Add error handling in many locations, new SpotifyCLIException, and update formatting and format checker (#85)
1 parent 95f3cb0 commit 0e2c7c7

File tree

3 files changed

+180
-115
lines changed

3 files changed

+180
-115
lines changed

check_format.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from os import system
1+
from subprocess import call
2+
import sys
23

34
files = [
45
"spotifycli/spotifycli.py",
@@ -10,9 +11,12 @@
1011

1112

1213
def check_format():
14+
any_failed = False
1315
for i in files:
14-
system(f"pycodestyle --show-source --show-pep8 --format=default {i}")
16+
exit_code = call(["pycodestyle", "--show-source", "--show-pep8", "--format=default", i])
17+
any_failed |= True if exit_code == 1 else False
18+
return any_failed
1519

1620

1721
if __name__ == "__main__":
18-
check_format()
22+
sys.exit(check_format())

spotifycli/__main__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
import sys
12
from .spotifycli import main
2-
main()
3+
sys.exit(main())

0 commit comments

Comments
 (0)