Skip to content

Commit bd8d473

Browse files
committed
chore(lint): run formatter on python files
1 parent af74070 commit bd8d473

16 files changed

Lines changed: 455 additions & 241 deletions

File tree

.github/workflows/scripts/components/compute_render_set.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ def main() -> None:
7474
# changed list AND with hand-edited specs would otherwise print twice,
7575
# and a component with N modified spec files would print N times.
7676
# dict.fromkeys preserves first-seen order.
77-
names = dict.fromkeys([
78-
*from_changed(entries),
79-
*from_specs_diff(args.specs_diff_file, args.specs_dir, renderable),
80-
])
77+
names = dict.fromkeys(
78+
[
79+
*from_changed(entries),
80+
*from_specs_diff(args.specs_diff_file, args.specs_dir, renderable),
81+
]
82+
)
8183
for name in names:
8284
print(name)
8385

.github/workflows/scripts/spec-review/create_check_annotations.py

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
# Mapping from finding category to (workflow command level, checks API level, checks API title)
2020
_SEVERITY_MAP = {
21-
"errors": ("error", "failure", "Spec Error"),
22-
"warnings": ("warning", "warning", "Spec Warning"),
23-
"suggestions": ("notice", "notice", "Suggestion"),
21+
"errors": ("error", "failure", "Spec Error"),
22+
"warnings": ("warning", "warning", "Spec Warning"),
23+
"suggestions": ("notice", "notice", "Suggestion"),
2424
}
2525

2626

@@ -61,7 +61,9 @@ def escape_workflow_command(s: str) -> str:
6161
)
6262

6363

64-
def generate_workflow_commands(report: dict, repo_root: Optional[Path] = None) -> list[str]:
64+
def generate_workflow_commands(
65+
report: dict, repo_root: Optional[Path] = None
66+
) -> list[str]:
6567
"""Generate GitHub Actions workflow commands for annotations."""
6668
commands = []
6769
for spec_file, category, finding in _iter_findings(report, repo_root):
@@ -73,33 +75,47 @@ def generate_workflow_commands(report: dict, repo_root: Optional[Path] = None) -
7375
return commands
7476

7577

76-
def generate_check_annotations(report: dict, repo_root: Optional[Path] = None) -> list[dict]:
78+
def generate_check_annotations(
79+
report: dict, repo_root: Optional[Path] = None
80+
) -> list[dict]:
7781
"""Generate annotations for GitHub Checks API."""
7882
annotations = []
7983
for spec_file, category, finding in _iter_findings(report, repo_root):
8084
_, api_level, title = _SEVERITY_MAP[category]
8185
line = finding.get("line") or 1
8286
msg = _format_message(finding)
83-
annotations.append({
84-
"path": spec_file,
85-
"start_line": line,
86-
"end_line": line,
87-
"annotation_level": api_level,
88-
"message": msg,
89-
"title": title,
90-
})
87+
annotations.append(
88+
{
89+
"path": spec_file,
90+
"start_line": line,
91+
"end_line": line,
92+
"annotation_level": api_level,
93+
"message": msg,
94+
"title": title,
95+
}
96+
)
9197
return annotations
9298

9399

94100
def main() -> int:
95-
parser = argparse.ArgumentParser(description="Generate check annotations from spec review")
101+
parser = argparse.ArgumentParser(
102+
description="Generate check annotations from spec review"
103+
)
96104
parser.add_argument("file", type=Path, help="Path to report JSON")
97-
parser.add_argument("--workflow-commands", action="store_true",
98-
help="Output GitHub Actions workflow commands")
99-
parser.add_argument("--json", action="store_true",
100-
help="Output annotations as JSON for Checks API")
101-
parser.add_argument("--repo-root", type=Path, default=None,
102-
help="Repository root for converting absolute paths to relative (default: auto-detect via git)")
105+
parser.add_argument(
106+
"--workflow-commands",
107+
action="store_true",
108+
help="Output GitHub Actions workflow commands",
109+
)
110+
parser.add_argument(
111+
"--json", action="store_true", help="Output annotations as JSON for Checks API"
112+
)
113+
parser.add_argument(
114+
"--repo-root",
115+
type=Path,
116+
default=None,
117+
help="Repository root for converting absolute paths to relative (default: auto-detect via git)",
118+
)
103119
args = parser.parse_args()
104120

105121
try:

.github/workflows/scripts/spec-review/format_pr_comment.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
MAX_RAW_JSON_CHARS = 50_000
2020

2121

22-
def format_comment(report: dict, repo: str, sha: str, repo_root: Optional[Path] = None) -> str:
22+
def format_comment(
23+
report: dict, repo: str, sha: str, repo_root: Optional[Path] = None
24+
) -> str:
2325
"""Format the report as a markdown comment."""
2426
reviews = report.get("spec_reviews", [])
2527

@@ -66,7 +68,9 @@ def format_comment(report: dict, repo: str, sha: str, repo_root: Optional[Path]
6668
if Path(spec_path).is_absolute():
6769
spec_link = f"`{spec_name}`"
6870
else:
69-
spec_link = f"[`{spec_name}`](https://github.com/{repo}/blob/{sha}/{spec_path})"
71+
spec_link = (
72+
f"[`{spec_name}`](https://github.com/{repo}/blob/{sha}/{spec_path})"
73+
)
7074
lines.append(f"### {spec_link}")
7175
lines.append("")
7276

@@ -102,7 +106,9 @@ def format_comment(report: dict, repo: str, sha: str, repo_root: Optional[Path]
102106
lines.append("<summary>📄 Raw JSON Report</summary>")
103107
lines.append("")
104108
if len(raw_json) > MAX_RAW_JSON_CHARS:
105-
lines.append("*Report too large to display inline. See uploaded artifacts for the full report.*")
109+
lines.append(
110+
"*Report too large to display inline. See uploaded artifacts for the full report.*"
111+
)
106112
else:
107113
lines.append("```json")
108114
lines.append(raw_json)
@@ -118,8 +124,12 @@ def main() -> int:
118124
parser.add_argument("file", type=Path, help="Path to report JSON")
119125
parser.add_argument("--repo", required=True, help="GitHub repo (owner/repo)")
120126
parser.add_argument("--sha", required=True, help="Commit SHA for file links")
121-
parser.add_argument("--repo-root", type=Path, default=None,
122-
help="Repository root for converting absolute paths to relative")
127+
parser.add_argument(
128+
"--repo-root",
129+
type=Path,
130+
default=None,
131+
help="Repository root for converting absolute paths to relative",
132+
)
123133
args = parser.parse_args()
124134

125135
try:

.github/workflows/scripts/spec-review/spec_review_schema.py

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def has_errors(self) -> bool:
7575
def print_summary(self):
7676
status = "ERRORS FOUND" if self.has_errors else "No errors"
7777
print(f"{status}")
78-
print(f"Specs: {len(self.spec_reviews)} | Errors: {self.total_errors} | Warnings: {self.total_warnings} | Suggestions: {self.total_suggestions}")
78+
print(
79+
f"Specs: {len(self.spec_reviews)} | Errors: {self.total_errors} | Warnings: {self.total_warnings} | Suggestions: {self.total_suggestions}"
80+
)
7981

8082
def print_errors(self):
8183
for review in self.spec_reviews:
@@ -119,7 +121,9 @@ def _load_report(path: Path) -> SpecReviewReport:
119121
return SpecReviewReport.from_file(path)
120122

121123

122-
def _findings_set(reviews: list[SpecReview], severity: str) -> dict[tuple[str, str], Finding]:
124+
def _findings_set(
125+
reviews: list[SpecReview], severity: str
126+
) -> dict[tuple[str, str], Finding]:
123127
"""Build a lookup of (spec_name, description) -> Finding for a severity level."""
124128
result: dict[tuple[str, str], Finding] = {}
125129
for review in reviews:
@@ -145,8 +149,14 @@ def compare_reports(
145149
print(f"┌─{'─' * col_w}─┬────────┬──────────┬─────────────┐")
146150
print(f"│ {'Model':<{col_w}} │ Errors │ Warnings │ Suggestions │")
147151
print(f"├─{'─' * col_w}─┼────────┼──────────┼─────────────┤")
148-
for label, report in [(label_a, report_a), (label_b, report_b), (label_final, report_final)]:
149-
print(f"│ {label:<{col_w}}{report.total_errors:>6}{report.total_warnings:>8}{report.total_suggestions:>11} │")
152+
for label, report in [
153+
(label_a, report_a),
154+
(label_b, report_b),
155+
(label_final, report_final),
156+
]:
157+
print(
158+
f"│ {label:<{col_w}}{report.total_errors:>6}{report.total_warnings:>8}{report.total_suggestions:>11} │"
159+
)
150160
print(f"└─{'─' * col_w}─┴────────┴──────────┴─────────────┘")
151161
print()
152162

@@ -199,14 +209,24 @@ def main() -> int:
199209

200210
# Route to compare subcommand if first arg is "compare"
201211
if len(sys.argv) > 1 and sys.argv[1] == "compare":
202-
parser = argparse.ArgumentParser(description="Compare multi-model spec review reports")
212+
parser = argparse.ArgumentParser(
213+
description="Compare multi-model spec review reports"
214+
)
203215
parser.add_argument("_cmd", metavar="compare")
204216
parser.add_argument("report_a", type=Path, help="Report from reviewer A")
205217
parser.add_argument("report_b", type=Path, help="Report from reviewer B")
206218
parser.add_argument("report_final", type=Path, help="Final synthesized report")
207-
parser.add_argument("--label-a", default="Reviewer A", help="Display label for reviewer A")
208-
parser.add_argument("--label-b", default="Reviewer B", help="Display label for reviewer B")
209-
parser.add_argument("--label-final", default="Synthesized", help="Display label for final report")
219+
parser.add_argument(
220+
"--label-a", default="Reviewer A", help="Display label for reviewer A"
221+
)
222+
parser.add_argument(
223+
"--label-b", default="Reviewer B", help="Display label for reviewer B"
224+
)
225+
parser.add_argument(
226+
"--label-final",
227+
default="Synthesized",
228+
help="Display label for final report",
229+
)
210230
args = parser.parse_args()
211231

212232
try:
@@ -234,11 +254,21 @@ def main() -> int:
234254
# Original validate behavior
235255
parser = argparse.ArgumentParser(description="Validate spec review report")
236256
parser.add_argument("file", type=Path, help="Path to report JSON")
237-
parser.add_argument("--errors", action="store_true", help="Print errors", default=False)
238-
parser.add_argument("--warnings", action="store_true", help="Print warnings", default=False)
239-
parser.add_argument("--suggestions", action="store_true", help="Print suggestions", default=False)
240-
parser.add_argument("--all", action="store_true", help="Print all findings", default=False)
241-
parser.add_argument("--json", action="store_true", help="Output summary as JSON", default=False)
257+
parser.add_argument(
258+
"--errors", action="store_true", help="Print errors", default=False
259+
)
260+
parser.add_argument(
261+
"--warnings", action="store_true", help="Print warnings", default=False
262+
)
263+
parser.add_argument(
264+
"--suggestions", action="store_true", help="Print suggestions", default=False
265+
)
266+
parser.add_argument(
267+
"--all", action="store_true", help="Print all findings", default=False
268+
)
269+
parser.add_argument(
270+
"--json", action="store_true", help="Output summary as JSON", default=False
271+
)
242272

243273
args = parser.parse_args()
244274

@@ -260,7 +290,11 @@ def main() -> int:
260290
report.print_summary()
261291
# If --all or no specific flags, show errors by default
262292
show_all = args.all
263-
show_errors = args.errors or show_all or (not args.errors and not args.warnings and not args.suggestions)
293+
show_errors = (
294+
args.errors
295+
or show_all
296+
or (not args.errors and not args.warnings and not args.suggestions)
297+
)
264298
show_warnings = args.warnings or show_all
265299
show_suggestions = args.suggestions or show_all
266300

.vscode/mcps/_mcp_utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,13 @@ def load_env(env_path: str | Path | None = None) -> None:
6969
print(f"[mcp] Loaded .env from {c}", file=sys.stderr)
7070
return
7171

72-
print("[mcp] No .env file found (checked: "
73-
+ ", ".join(str(p) for p in candidates) + ")",
74-
file=sys.stderr)
72+
print(
73+
"[mcp] No .env file found (checked: "
74+
+ ", ".join(str(p) for p in candidates)
75+
+ ")",
76+
file=sys.stderr,
77+
)
78+
7579

7680
# Valid RPM package name characters: starts with alphanumeric, then
7781
# alphanumerics plus . _ + -

0 commit comments

Comments
 (0)