File findings, release reviews and added items as the issue types the settings name, and refuse a type the Jira project lacks

This commit is contained in:
Lilleman
2026-11-20 11:31:44 +01:00
parent 88fee92dcb
commit 34328b11b9
15 changed files with 179 additions and 30 deletions
+13 -2
View File
@@ -62,8 +62,11 @@ JIRA_FINISH = (JIRA_FINISH_TRANSITION, JIRA_FINISH_STATUS)
JIRA_SCORE_FORMULA = "jira-score-formula"
JIRA_SCORE_BAR = "jira-score-bar"
JIRA_SCORE = (JIRA_SCORE_FORMULA, JIRA_SCORE_BAR)
# The issue type `todo-item add` files an item as, and do-epic files a finding as; the default is the one Jira ships in every project of its software templates, which a project may lack.
JIRA_FINDING_TYPE = "jira-finding-type"
DEFAULT_ISSUE_TYPE = "Task"
# The settings allowed only where `plan` names a Jira epic.
JIRA_PLAN_ONLY = (*JIRA_FINISH, *JIRA_SCORE)
JIRA_PLAN_ONLY = (*JIRA_FINISH, *JIRA_SCORE, JIRA_FINDING_TYPE)
# What opens a setting that names a Jira Cloud epic in place of a path: `jira:`, then the epic's address as the browser shows it. The settings below may name an epic; each reads its own part of it.
JIRA = "jira:"
EPIC_SPELLINGS = {
@@ -146,6 +149,8 @@ class ProjectConfig:
notifier: Notifier | None = None
# The config's `jira-finish-transition` and `jira-finish-status`, or None where it sets neither.
jira_finish: Finish | None = None
# The config's `jira-finding-type`, the issue type `todo-item add` files an item as.
jira_finding_type: str = DEFAULT_ISSUE_TYPE
# The config's `jira-score-formula` and `jira-score-bar`, which it sets where `plan` names an epic.
jira_scoring: JiraScoring | None = None
# The Confluence page of each record the config keeps on one, by the record's setting.
@@ -286,6 +291,11 @@ def text_read(fault: typing.Callable[[object], str | None]) -> typing.Callable[[
return read
def type_fault(value: object, example: str = "Feature") -> str | None:
"""Why value is no issue type's name; None where it is one. example is a name a message quotes."""
return None if name_of(value) else f'not the name Jira shows, such as "{example}"'
def formula_fault(value: object) -> str | None:
"""Why value is no formula that may score an item, as todo.md's `Score` line states one; None where it is one."""
if not isinstance(value, str):
@@ -359,8 +369,9 @@ SCALARS = (
Scalar(COMMIT_TITLE, "commit_title", text_read(templates.title_fault)),
Scalar(PULL_REQUEST_TITLE, "pull_request_title", text_read(templates.title_fault)),
Scalar(BRANCH, "branch", text_read(templates.branch_fault)),
Scalar(JIRA_FINDING_TYPE, "jira_finding_type", text_read(type_fault)),
)
OPTIONAL = tuple(sorted((CODING_CONVENTIONS, ENV_FILE, TOUCH_PREDICTIONS, *JIRA_PLAN_ONLY, *(scalar.name for scalar in SCALARS))))
OPTIONAL = tuple(sorted({CODING_CONVENTIONS, ENV_FILE, TOUCH_PREDICTIONS, *JIRA_PLAN_ONLY, *(scalar.name for scalar in SCALARS)}))
def lies_in(path: pathlib.Path, *places: pathlib.Path) -> bool: