From ab72aae5ae7e363837ad6f135ac8c5516ff55059 Mon Sep 17 00:00:00 2001 From: Patrick Dougherty Date: Thu, 27 Feb 2025 12:09:37 -0600 Subject: [PATCH] [CI] Add pre-commit-config to internal source of truth MODULAR_ORIG_COMMIT_REV_ID: 14e2678c27e07378a49cdfcae41feae5b7c27fb6 --- .pre-commit-config.yaml | 26 +++++++++++++++++++++++++ mojo/stdlib/scripts/check-docstrings.py | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..b04addfbb6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,26 @@ +repos: + - repo: local + hooks: + - id: mojo-format + name: mojo-format + entry: mojo format mojo + language: system + files: '\.(mojo|🔥|py)$' + stages: [commit] + - id: check-docstrings + name: check-docstrings + entry: python3 ./mojo/stdlib/scripts/check-docstrings.py + language: system + pass_filenames: false + stages: [commit] + - id: check-license + name: check-license + entry: mojo mojo/stdlib/scripts/check_licenses.mojo + language: system + files: '\.(mojo|🔥|py)$' + stages: [commit] + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.40.0 + hooks: + - id: markdownlint + args: ['--config', 'mojo/stdlib/scripts/.markdownlint.yaml', '--fix'] diff --git a/mojo/stdlib/scripts/check-docstrings.py b/mojo/stdlib/scripts/check-docstrings.py index ddba7bb42c..1eb77ea27e 100644 --- a/mojo/stdlib/scripts/check-docstrings.py +++ b/mojo/stdlib/scripts/check-docstrings.py @@ -27,7 +27,7 @@ def main(): "--diagnose-missing-doc-strings", "-o", "/dev/null", - "./stdlib/src", + "./mojo/stdlib/src", ] result = subprocess.run(command, capture_output=True) if result.stderr or result.returncode != 0: