This commit is contained in:
@@ -51,6 +51,11 @@ def unfit(summary: str, labels: tuple[str, ...]) -> Failure | None:
|
||||
"""Why no tracker can file an issue with this summary and these labels; None where one can."""
|
||||
if not summary.strip() or "\n" in summary:
|
||||
return Failure("the summary must be one line of text")
|
||||
return unfit_label(*labels)
|
||||
|
||||
|
||||
def unfit_label(*labels: str) -> Failure | None:
|
||||
"""Why no tracker can take one of these labels; None where one can."""
|
||||
if bad := next((label for label in labels if not LABEL.fullmatch(label)), None):
|
||||
return Failure(f"the label {bad!r} is empty or holds white space")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user