Skip to content

Commit

Permalink
Fix G201 ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Oct 25, 2023
1 parent 544769d commit 78e4577
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
31 changes: 13 additions & 18 deletions lib/galaxy/tools/error_reports/plugins/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ def __init__(self, **kwargs):
self.gitlab.auth()

except gitlab.GitlabAuthenticationError:
log.error("GitLab error reporting - Could not authenticate with GitLab.", exc_info=True)
log.exception("GitLab error reporting - Could not authenticate with GitLab.")
self.gitlab = None
except gitlab.GitlabParsingError:
log.error("GitLab error reporting - Could not parse GitLab message.", exc_info=True)
log.exception("GitLab error reporting - Could not parse GitLab message.")
self.gitlab = None
except (gitlab.GitlabConnectionError, gitlab.GitlabHttpError):
log.error("GitLab error reporting - Could not connect to GitLab.", exc_info=True)
log.exception("GitLab error reporting - Could not connect to GitLab.")
self.gitlab = None
except gitlab.GitlabError:
log.error("GitLab error reporting - General error communicating with GitLab.", exc_info=True)
log.exception("GitLab error reporting - General error communicating with GitLab.")
self.gitlab = None

def gitlab_connect(self):
Expand Down Expand Up @@ -195,34 +195,29 @@ def submit_report(self, dataset, job, tool, **kwargs):
)

except gitlab.GitlabCreateError:
log.error("GitLab error reporting - Could not create the issue on GitLab.", exc_info=True)
log.exception("GitLab error reporting - Could not create the issue on GitLab.")
return ("Internal Error.", "danger")
except gitlab.GitlabOwnershipError:
log.error(
"GitLab error reporting - Could not create the issue on GitLab due to ownership issues.",
exc_info=True,
)
log.exception("GitLab error reporting - Could not create the issue on GitLab due to ownership issues.")
return ("Internal Error.", "danger")
except gitlab.GitlabSearchError:
log.error("GitLab error reporting - Could not find repository on GitLab.", exc_info=True)
log.exception("GitLab error reporting - Could not find repository on GitLab.")
return ("Internal Error.", "danger")
except gitlab.GitlabAuthenticationError:
log.error("GitLab error reporting - Could not authenticate with GitLab.", exc_info=True)
log.exception("GitLab error reporting - Could not authenticate with GitLab.")
return ("Internal Error.", "danger")
except gitlab.GitlabParsingError:
log.error("GitLab error reporting - Could not parse GitLab message.", exc_info=True)
log.exception("GitLab error reporting - Could not parse GitLab message.")
return ("Internal Error.", "danger")
except (gitlab.GitlabConnectionError, gitlab.GitlabHttpError):
log.error("GitLab error reporting - Could not connect to GitLab.", exc_info=True)
log.exception("GitLab error reporting - Could not connect to GitLab.")
return ("Internal Error.", "danger")
except gitlab.GitlabError:
log.error("GitLab error reporting - General error communicating with GitLab.", exc_info=True)
log.exception("GitLab error reporting - General error communicating with GitLab.")
return ("Internal Error.", "danger")
except Exception:
log.error(
"GitLab error reporting - Error reporting to GitLab had an exception that could not be "
"determined.",
exc_info=True,
log.exception(
"GitLab error reporting - Error reporting to GitLab had an exception that could not be determined.",
)
return ("Internal Error.", "danger")
else:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ target-version = "py37"
# E402 module level import not at top of file # TODO, we would like to improve this.
# E501 is line length (delegated to black)
# G* are TODOs
ignore = ["B008", "B9", "E402", "E501", "G001", "G002", "G004", "G201"]
ignore = ["B008", "B9", "E402", "E501", "G001", "G002", "G004"]
exclude = [
"lib/tool_shed/test/test_data/repos"
]
Expand Down

0 comments on commit 78e4577

Please sign in to comment.