| 16 | |
| 17 | |
| 18 | def build_parser() -> argparse.ArgumentParser: |
| 19 | parser = argparse.ArgumentParser( |
| 20 | prog="extended_linter", |
| 21 | description="OctoBot PR policy linter (git scope, paths, diff content)", |
| 22 | ) |
| 23 | parser.add_argument( |
| 24 | "--base", |
| 25 | default="origin/dev", |
| 26 | help="Merge base git ref (default: origin/dev)", |
| 27 | ) |
| 28 | parser.add_argument( |
| 29 | "--repo-root", |
| 30 | type=pathlib.Path, |
| 31 | default=None, |
| 32 | help="OctoBot repository root (default: nearest .git from cwd)", |
| 33 | ) |
| 34 | parser.add_argument( |
| 35 | "--policy", |
| 36 | type=pathlib.Path, |
| 37 | default=None, |
| 38 | help="Path to policy.yaml (default: bundled policy)", |
| 39 | ) |
| 40 | parser.add_argument( |
| 41 | "--report", |
| 42 | choices=("text", "json"), |
| 43 | default="text", |
| 44 | help="Report format (default: text)", |
| 45 | ) |
| 46 | parser.add_argument( |
| 47 | "--continue", |
| 48 | dest="continue_on_violation", |
| 49 | action="store_true", |
| 50 | help="Always run all checks (default; same as omitting stop-on-first)", |
| 51 | ) |
| 52 | parser.add_argument( |
| 53 | "--skip-tentacles-reinstall", |
| 54 | action="store_true", |
| 55 | help="Do not run reinstall-tentacles.sh when tentacles sources change", |
| 56 | ) |
| 57 | parser.add_argument( |
| 58 | "--write-report", |
| 59 | type=pathlib.Path, |
| 60 | default=None, |
| 61 | help="Write report file (format from --report)", |
| 62 | ) |
| 63 | parser.add_argument( |
| 64 | "--write-report-json", |
| 65 | type=pathlib.Path, |
| 66 | default=None, |
| 67 | help="Also write JSON report to this path (single run, any --report stdout format)", |
| 68 | ) |
| 69 | return parser |
| 70 | |
| 71 | |
| 72 | def main(argv: list[str] | None = None) -> int: |