mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Reduce number of return statements
This commit is contained in:
parent
c29aa0cd49
commit
cdceac6624
@ -132,6 +132,7 @@ def check_pr_description(pr_info: PRInfo) -> Tuple[str, str]:
|
|||||||
|
|
||||||
category = ""
|
category = ""
|
||||||
entry = ""
|
entry = ""
|
||||||
|
description_error = ""
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while i < len(lines):
|
while i < len(lines):
|
||||||
@ -183,22 +184,19 @@ def check_pr_description(pr_info: PRInfo) -> Tuple[str, str]:
|
|||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
if not category:
|
if not category:
|
||||||
return "Changelog category is empty", category
|
description_error = "Changelog category is empty"
|
||||||
|
|
||||||
# Filter out the PR categories that are not for changelog.
|
# Filter out the PR categories that are not for changelog.
|
||||||
if re.match(
|
elif re.match(
|
||||||
r"(?i)doc|((non|in|not|un)[-\s]*significant)|(not[ ]*for[ ]*changelog)",
|
r"(?i)doc|((non|in|not|un)[-\s]*significant)|(not[ ]*for[ ]*changelog)",
|
||||||
category,
|
category,
|
||||||
):
|
):
|
||||||
return "", category
|
pass # to not check the rest of the conditions
|
||||||
|
elif category not in CATEGORY_TO_LABEL:
|
||||||
|
description_error, category = f"Category '{category}' is not valid", ""
|
||||||
|
elif not entry:
|
||||||
|
description_error = f"Changelog entry required for category '{category}'"
|
||||||
|
|
||||||
if category not in CATEGORY_TO_LABEL:
|
return description_error, category
|
||||||
return f"Category '{category}' is not valid", ""
|
|
||||||
|
|
||||||
if not entry:
|
|
||||||
return f"Changelog entry required for category '{category}'", category
|
|
||||||
|
|
||||||
return "", category
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user