Skip to content

Commit e255519

Browse files
committed
Remove unused import HTTPError
1 parent de781d8 commit e255519

File tree

14 files changed

+18
-19
lines changed

14 files changed

+18
-19
lines changed

cli/findings_export.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def __get_component_findings(queue: Queue[tuple[object, ConfigSettings]], write_
294294
findings_list = findings.export_findings(
295295
component.endpoint, component.key, branch=params.get("branch", None), pull_request=params.get("pullRequest", None)
296296
)
297-
except (ConnectionError, RequestException) as e:
297+
except (HTTPError, ConnectionError, RequestException) as e:
298298
log.critical("%s while exporting findings of %s, skipped", util.error_msg(e), str(component))
299299
findings_list = {}
300300
write_queue.put([findings_list, False])
@@ -323,7 +323,7 @@ def __get_component_findings(queue: Queue[tuple[object, ConfigSettings]], write_
323323
if (i_statuses or not status_list) and (i_resols or not resol_list) and (i_types or not type_list) and (i_sevs or not sev_list):
324324
try:
325325
findings_list = component.get_issues(filters=new_params)
326-
except (ConnectionError, RequestException) as e:
326+
except (HTTPError, ConnectionError, RequestException) as e:
327327
log.critical("%s while exporting issues of %s, skipped", util.error_msg(e), str(component))
328328
findings_list = {}
329329
else:
@@ -333,7 +333,7 @@ def __get_component_findings(queue: Queue[tuple[object, ConfigSettings]], write_
333333
if (h_statuses or not status_list) and (h_resols or not resol_list) and (h_types or not type_list) and (h_sevs or not sev_list):
334334
try:
335335
findings_list.update(component.get_hotspots(filters=new_params))
336-
except (ConnectionError, RequestException) as e:
336+
except (HTTPError, ConnectionError, RequestException) as e:
337337
log.error("%s while exporting hotspots of object key %s, skipped", util.error_msg(e), str(component))
338338
else:
339339
log.debug("Status = %s, Types = %s, Resol = %s, Sev = %s", str(h_statuses), str(h_types), str(h_resols), str(h_sevs))
@@ -351,7 +351,7 @@ def store_findings(components_list: dict[str, object], params: ConfigSettings) -
351351
try:
352352
log.debug("Queue %s task %s put", str(my_queue), str(comp))
353353
my_queue.put((comp, params.copy()))
354-
except (ConnectionError, RequestException) as e:
354+
except (HTTPError, ConnectionError, RequestException) as e:
355355
log.critical("%s while exporting findings of %s, skipped", util.error_msg(e), str(comp))
356356

357357
threads = params.get(options.NBR_THREADS, 4)

cli/loc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import sys
2525
import csv
2626
import datetime
27-
from requests import HTTPError, RequestException
27+
from requests import RequestException
2828

2929
from cli import options
3030
import sonar.logging as log

cli/measures_export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
from typing import Union
3131

32-
from requests import HTTPError, RequestException
32+
from requests import RequestException
3333
from sonar.util import types
3434
from cli import options
3535
import sonar.logging as log

sonar/app_branches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import json
2626
from http import HTTPStatus
27-
from requests import HTTPError, RequestException
27+
from requests import RequestException
2828
from requests.utils import quote
2929

3030
import sonar.logging as log

sonar/applications.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from datetime import datetime
2727
from http import HTTPStatus
2828
from threading import Lock
29-
from requests import HTTPError, RequestException
29+
from requests import RequestException
3030

3131
import sonar.logging as log
3232
import sonar.platform as pf

sonar/branches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def audit(self, audit_settings: types.ConfigSettings) -> list[Problem]:
364364
log.debug("Auditing %s", str(self))
365365
try:
366366
return self.__audit_last_analysis(audit_settings) + self.__audit_zero_loc() + self.__audit_never_analyzed()
367-
except (HTTPError, RequestException, Exception) as e:
367+
except Exception as e:
368368
log.error("%s while auditing %s, audit skipped", util.error_msg(e), str(self))
369369
else:
370370
log.debug("Branch audit disabled, skipping audit of %s", str(self))

sonar/devops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from http import HTTPStatus
2424
import json
2525

26-
from requests import HTTPError, RequestException
26+
from requests import RequestException
2727

2828
import sonar.logging as log
2929
from sonar.util import types

sonar/hotspots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import json
2525
import re
2626
from http import HTTPStatus
27-
from requests import HTTPError, RequestException
27+
from requests import RequestException
2828
import requests.utils
2929

3030
import sonar.logging as log

sonar/issues.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from queue import Queue
3030
from threading import Thread
3131
import requests.utils
32-
from requests import HTTPError, RequestException
3332

3433
import sonar.logging as log
3534
import sonar.platform as pf
@@ -732,7 +731,7 @@ def __search_thread(queue: Queue) -> None:
732731
i["pullRequest"] = page_params.get("pullRequest", None)
733732
issue_list[i["key"]] = get_object(endpoint=endpoint, key=i["key"], data=i)
734733
log.debug("Added %d issues in threaded search page %d", len(data["issues"]), page)
735-
except (HTTPError, RequestException, Exception) as e:
734+
except Exception as e:
736735
log.error("%s while searching issues, search may be incomplete", util.error_msg(e))
737736
queue.task_done()
738737

@@ -858,7 +857,7 @@ def count_by_rule(endpoint: pf.Platform, **kwargs) -> dict[str, int]:
858857
if d["val"] not in rulecount:
859858
rulecount[d["val"]] = 0
860859
rulecount[d["val"]] += d["count"]
861-
except (HTTPError, Exception, RequestException) as e:
860+
except Exception as e:
862861
log.error("%s while counting issues per rule, count may be incomplete", util.error_msg(e))
863862
return rulecount
864863

sonar/permissions/permission_templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import json
2424
import re
25-
from requests import HTTPError, RequestException
25+
from requests import RequestException
2626

2727
import sonar.logging as log
2828
from sonar.util import types

0 commit comments

Comments
 (0)