diff --git a/scripts/fleet/fleet-health b/scripts/fleet/fleet-health index b3be1576c..4c7955e25 100755 --- a/scripts/fleet/fleet-health +++ b/scripts/fleet/fleet-health @@ -75,6 +75,7 @@ from pathlib import Path sys.path.insert(0, os.path.dirname(os.path.realpath(__file__))) import fleet_alerts # noqa: E402 import fleet_github # noqa: E402 +from fleet_public_text import term_file_path # noqa: E402 from fleet_runtime import REPO_SLUGS # noqa: E402 REPO_KEYS = {slug: key for key, slug in REPO_SLUGS.items()} @@ -958,6 +959,7 @@ def build_report(args): alerts_dir = Path(os.environ.get("FLEET_ALERTS_DIR") or fleet_dir / "alerts") conf_path = Path(os.environ.get("FLEET_CONF") or fleet_dir / "fleet-up.conf") dispatch_dir = state_dir / "dispatch" + terms_path = term_file_path() log_lines = [] for name in ("dispatcher.log", "fleet-rebase.log", "fleet-automerge.log", "state-scout.log"): @@ -1007,8 +1009,8 @@ def build_report(args): "worktree_leaks": worktrees, "github": collect_github(state_dir / "gh-accounting", since, now_utc()), "public_text_terms": { - "path": str(fleet_dir / "public-text-terms"), - "configured": (fleet_dir / "public-text-terms").is_file(), + "path": str(terms_path), + "configured": terms_path.is_file(), }, } report["warnings"] = derive_warnings(roles, triggers, rebase, runtimes, daemons, alerts, diff --git a/scripts/fleet/fleet-pr-closes-lint b/scripts/fleet/fleet-pr-closes-lint index d313818f5..380d1d87e 100755 --- a/scripts/fleet/fleet-pr-closes-lint +++ b/scripts/fleet/fleet-pr-closes-lint @@ -252,11 +252,17 @@ def main(argv=None): file=sys.stderr) return 2 - public_findings = fleet_public_text.find_public_text( - title + "\n" + body, pr_slug, git_root=os.getcwd()) + public_findings = [ + ("title", finding) + for finding in fleet_public_text.find_public_text(title, pr_slug, git_root=os.getcwd()) + ] + public_findings += [ + ("body", finding) + for finding in fleet_public_text.find_public_text(body, pr_slug, git_root=os.getcwd()) + ] if public_findings: - for finding in public_findings: - print(f"PUBLIC-TEXT {fleet_public_text.format_finding(finding)}") + for source, finding in public_findings: + print(f"PUBLIC-TEXT {finding.kind} {source} line {finding.line}") print(f" {finding.text}", file=sys.stderr) return 1 diff --git a/scripts/fleet/fleet_public_text.py b/scripts/fleet/fleet_public_text.py index 888e3c122..a1ea4fa02 100644 --- a/scripts/fleet/fleet_public_text.py +++ b/scripts/fleet/fleet_public_text.py @@ -11,7 +11,6 @@ from fleet_runtime import REPO_SLUGS -DEFAULT_TERM_FILE = Path.home() / ".fleet" / "public-text-terms" CREATION_PATH_RE = re.compile(r"(?