Skip to content

Commit 48b32b4

Browse files
committed
feat: add --warn-only to validate.py for pre-commit informational mode
1 parent 5123f49 commit 48b32b4

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ repos:
4747
hooks:
4848
- id: docs-mdx-validate
4949
name: Validate generated MDX docs
50-
entry: bash -c 'test -d docs/docs/api && uv run --no-sync python tooling/docs-autogen/validate.py docs/docs/api --skip-coverage || true'
50+
entry: bash -c 'test -d docs/docs/api && uv run --no-sync python tooling/docs-autogen/validate.py docs/docs/api --skip-coverage --warn-only || true'
5151
language: system
5252
pass_filenames: false
5353
files: (docs/docs/.*\.mdx$|tooling/docs-autogen/)

tooling/docs-autogen/validate.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,11 @@ def main():
735735
"--docs-root",
736736
help="Root docs/ directory for stale-file checks (default: parent of docs_dir)",
737737
)
738+
parser.add_argument(
739+
"--warn-only",
740+
action="store_true",
741+
help="Print issues but always exit 0 (pre-commit informational mode)",
742+
)
738743
args = parser.parse_args()
739744

740745
docs_dir = Path(args.docs_dir)
@@ -871,7 +876,7 @@ def main():
871876
output_path.write_text(json.dumps(report, indent=2))
872877
print(f"\n📄 Report saved to {output_path}")
873878

874-
sys.exit(0 if report["overall_passed"] else 1)
879+
sys.exit(0 if (report["overall_passed"] or args.warn_only) else 1)
875880

876881

877882
if __name__ == "__main__":

0 commit comments

Comments
 (0)