Repository navigation
fix: sdlc ci and sdlc tiers name the push verdicts a repo skipped (#50) #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -296,6 +296,23 @@ def resolve(cfg: dict, command: str) -> list[str]: | |
| return out | ||
|
|
||
|
|
||
| def push_skips(cfg: dict) -> list[str]: | ||
| """The push verdicts ci does not run because [tool.sdlc.push] skips them. | ||
|
|
||
| That skip is the only way a repo takes a verdict out of ci, and a verdict | ||
| that is not run is otherwise just absent: a green `sdlc ci` read the same | ||
| whether the repo ran lint or opted out of it (python-sdlc#50). | ||
| """ | ||
| drop = set(names(block(cfg, "push").get("skip"), "[tool.sdlc.push] skip")) | ||
| ci = resolve(cfg, "ci") | ||
| return [c for c in DEFAULTS["push"] if c in drop and c not in CI_EXCLUDES and c not in ci] | ||
|
|
||
|
|
||
| def push_skip_line(cfg: dict) -> str | None: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL (Documentation): The newly added public function Suggestion: Add a docstring explaining that it returns the formatted skip notice when push verdicts are skipped, and Evidence:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a bug: this is the same finding as discussion_r4597617417, raised again on the rebased head, and it gets the same answer. push_skip_line is a one-line formatter over push_skips, and push_skips' docstring sits directly above it. The |
||
| gone = push_skips(cfg) | ||
| return f"sdlc ci: not run, skipped in [tool.sdlc.push]: {', '.join(gone)}" if gone else None | ||
|
|
||
|
|
||
| def check_settings(cfg: dict, name: str) -> dict: | ||
| """A check's own table, wherever it is written. Names are unique.""" | ||
| found = [ | ||
|
|
@@ -469,6 +486,10 @@ def t_plan(target: str) -> int: | |
| for check in checks: | ||
| if check not in BUILTINS and kind_of(cfg, check) is None: | ||
| cannot(f"unknown check: {check}") | ||
| # stderr, because stdout is the plan the launcher parses. | ||
| line = push_skip_line(cfg) if target == "ci" else None | ||
| if line: | ||
| print(line, file=sys.stderr) | ||
| lanes = lane_of(cfg, checks) | ||
| for check in checks: | ||
| lane = plain(lanes[check], "a lane name") | ||
|
|
@@ -495,6 +516,9 @@ def t_tiers() -> int: | |
| print(f" {check}{note}") | ||
| if parallel: | ||
| print(f" {len(set(lanes.values()))} lanes, run at the same time") | ||
| line = push_skip_line(cfg) if command == "ci" else None | ||
| if line: | ||
| print(f" {line}") | ||
| if skipped(): | ||
| print(f"\nSDLC_SKIP is skipping: {', '.join(sorted(skipped()))}") | ||
| return CLEAN | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRITICAL (Documentation): The new public function
push_skip_linehas no documentation. Its return value and the conditions under which it returnsNoneare not described.Suggestion: Add a docstring describing the formatted skip notice and that the function returns
Nonewhen there are no push skips to report.Evidence:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bug: push_skip_line is a one-line formatter over push_skips, whose docstring sits directly above it and explains what is named and why. Its
str | Nonereturn type and theif gone else Noneexpression already say when it returns None. Small helpers in this script, likeblockandnames, carry no docstring, and this follows that convention.sdlcis a script, not a library with a public API.