Skip to content

Commit 9ff3253

Browse files
committed
Fix SonarCloud smells
1 parent 6328662 commit 9ff3253

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/arguments/notion.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def get_token_from_cookie(cookie, token):
1414
for el in cookie:
1515
if el['name'] == token:
1616
return el
17-
pass
1817

1918
class NotionClient():
2019
"""
@@ -31,9 +30,9 @@ def get_token_from_file(self):
3130
with open(TOKEN_FILE_PATH, 'r') as f:
3231
data = f.read()
3332
except Exception as e:
34-
raise e
33+
print(e)
3534
if(not data or data==""):
36-
raise Exception("Token not found in file")
35+
raise RuntimeError("Token not found in file")
3736
else:
3837
return data
3938

@@ -65,7 +64,7 @@ def get_tokenv2_cookie(self):
6564
if not self.tokenv2_cookie:
6665
try:
6766
self.tokenv2_cookie = self.get_token_from_file()
68-
except:
67+
except Exception as e:
6968
try:
7069
cookies = self.get_cookies_from_login()
7170
self.tokenv2_cookie = get_token_from_cookie(cookies, 'token_v2')
@@ -76,6 +75,6 @@ def get_tokenv2_cookie(self):
7675
if self.tokenv2_cookie:
7776
os.environ[self.tokenv2_key] = str(self.tokenv2_cookie)
7877
self.save_token_file()
79-
return self.get_tokenv2_cookie
8078
else:
81-
raise Exception("Cookie unreachable")
79+
raise RuntimeError("Cookie unreachable")
80+
return self.get_tokenv2_cookie

src/arguments/utility.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def playbook_path(self):
4646
containing the path of dynamic_playbook.json and returns it
4747
"""
4848
if not os.getenv(self.key):
49-
if(sys.platform=='linux'):
50-
os.environ[self.key] = PLAYBOOK_FILE
49+
os.environ[self.key] = PLAYBOOK_FILE
5150
return os.getenv(self.key)
5251

5352
@property

0 commit comments

Comments
 (0)