forked from Universal-Commerce-Protocol/ucp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
101 lines (100 loc) · 3.67 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
101 lines (100 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
exclude: '^(\.github/|\.vscode/).*|CODE_OF_CONDUCT\.md|CHANGELOG\.md'
repos:
- repo: local
hooks:
- id: block-corporate-registries
name: Block corporate registries in uv.lock
entry: '(?i)(pkgs\.shopify\.io|us-npm\.pkg\.dev)'
language: pygrep
files: ^uv\.lock$
description: "Avoid corporate URLs (PR #108, #368). Fix: 'uv lock --refresh'."
# Docs-example validator. Requires the ucp-schema binary on PATH;
# install with `cargo install ucp-schema`. CI runs the full-corpus
# check on every PR as the mandatory backstop
# (.github/workflows/docs.yml).
#
# Two-hook split for fast local feedback:
# - validate-examples-changed: doc edits validate only changed files
# (~0.6s/file). Catches direct annotation/schema-binding errors
# immediately at commit time.
# - validate-examples-full: schema or validator-code edits trigger a
# full-corpus check (~12s) because a single schema change can
# invalidate examples across many docs (cross-file regression).
- id: validate-examples-changed
name: Validate JSON examples (changed docs)
entry: python3 scripts/validate_examples.py --schema-base source/schemas/ --file
language: system
pass_filenames: true
files: ^docs/.*\.md$
stages: [pre-commit, pre-push]
- id: validate-examples-full
name: Validate JSON examples (full corpus)
entry: python3 scripts/validate_examples.py --schema-base source/schemas/
language: system
pass_filenames: false
files: ^(source/schemas/|scripts/validate_examples\.py$)
stages: [pre-commit, pre-push]
- id: validate-examples-tests
name: Validator unit tests
entry: python3 scripts/test_validate_examples.py
language: system
pass_filenames: false
files: ^scripts/(validate_examples|test_validate_examples)\.py$
stages: [pre-commit, pre-push]
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v9.3.3
hooks:
- id: cspell # Spell check changed files
- id: cspell # Spell check the commit message
name: check commit message spelling
args:
- --no-must-find-files
- --no-progress
- --no-summary
- --files
- .git/COMMIT_EDITMSG
stages: [commit-msg]
always_run: true # This might not be necessary.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
- id: check-added-large-files
- id: check-shebang-scripts-are-executable
- id: check-executables-have-shebangs
# Python: Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.13
hooks:
# Run the linter
- id: ruff
args: [--fix]
# Run the formatter
- id: ruff-format
# Markdown: Markdownlint
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.47.0
hooks:
- id: markdownlint
args: [--config, .github/linters/.markdownlint.json]
# CSS: Stylelint
- repo: https://github.com/thibaudcolas/pre-commit-stylelint
rev: v14.4.0
hooks:
- id: stylelint
args: ["--fix", "**/*.css"]
additional_dependencies:
- stylelint
- stylelint-config-standard
# CSS: Prettier (Formatting)
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
name: prettier-css
# Only run on CSS files
types: [css]
# To run on everything (JS, JSON, MD), remove the 'types' line.