Skip to content

Commit f6ac185

Browse files
committed
Quality pass
1 parent 104db20 commit f6ac185

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

sonar/platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def __run_request(self, request: callable, api: str, params: types.ApiParams = N
305305
if any(msg in err_msg_lower for msg in ("insufficient privileges", "insufficient permissions")):
306306
raise exceptions.SonarException(err_msg, errcodes.SONAR_API_AUTHORIZATION) from e
307307
if "unknown url" in err_msg_lower:
308-
raise exceptions.UnsupportedOperation(err_msg)
308+
raise exceptions.UnsupportedOperation(err_msg) from e
309309
raise exceptions.SonarException(err_msg, errcodes.SONAR_API) from e
310310
except ConnectionError as e:
311311
util.handle_error(e, "")

sonar/projects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ def count_third_party_issues(self, filters: Optional[dict[str, str]] = None) ->
838838
return super().count_third_party_issues(filters)
839839
log.debug("Getting 3rd party issues on branches/PR")
840840
issue_counts = {}
841-
for comp in [c for c in branches_or_prs.values() if c]:
841+
for comp in [co for co in branches_or_prs.values() if co]:
842842
log.debug("Getting 3rd party issues for %s", str(comp))
843843
for k, total in comp.count_third_party_issues(filters).items():
844844
if k not in issue_counts:

sonar/util/cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def __str__(self) -> str:
4141
return "'undefined class' cache" if not self.object_class else f"'{self.object_class.__name__}' cache"
4242

4343
def set_class(self, object_class: object) -> None:
44+
"""Defines the class the cache is for"""
4445
self.object_class = object_class
4546

4647
def contents(self) -> str:

sonar/utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,4 +822,4 @@ def similar_strings(key1: str, key2: str, max_distance: int = 5) -> bool:
822822
if key1 == key2:
823823
return False
824824
max_distance = min(len(key1) // 2, len(key2) // 2, max_distance)
825-
return len(key2) >= 7 and (re.match(key2, key1)) or Levenshtein.distance(key1, key2, score_cutoff=6) <= max_distance
825+
return (len(key2) >= 7 and (re.match(key2, key1))) or Levenshtein.distance(key1, key2, score_cutoff=6) <= max_distance

0 commit comments

Comments
 (0)