|
5 | 5 | # https://docs.trunk.io/check/reference |
6 | 6 | # ============================================================================= |
7 | 7 |
|
| 8 | +version: 0.1 |
| 9 | + |
| 10 | +# CLI version pinned for reproducible runs (matches the version CI downloads). |
| 11 | +cli: |
| 12 | + version: 1.22.2 |
| 13 | + |
| 14 | +# The `trunk` plugin provides the linter/formatter definitions used below. |
| 15 | +# User definitions merge over the plugin: fields set in this file override the |
| 16 | +# plugin, everything else (files, tools, runtimes, version pins) is inherited. |
8 | 17 | plugins: |
9 | 18 | sources: |
10 | 19 | - id: trunk |
11 | 20 | ref: v1.2.2 |
12 | | - - id: community |
13 | | - ref: main |
| 21 | + uri: https://github.com/trunk-io/plugins |
14 | 22 |
|
15 | | -# Linters (auto-detected by file type) |
16 | | -linters: |
17 | | - actionlint: |
18 | | - enabled: true |
19 | | - commands: |
20 | | - - name: actionlint |
21 | | - run: actionlint ${target} |
22 | | - direct_configs: |
23 | | - - .github/workflows/*.yml |
24 | | - black: |
25 | | - enabled: true |
26 | | - commands: |
27 | | - - name: black |
28 | | - run: black --check --line-length 100 ${target} |
29 | | - direct_configs: |
30 | | - - pyproject.toml |
31 | | - - ruff.toml |
32 | | - clippy: |
33 | | - enabled: true |
34 | | - commands: |
35 | | - - name: clippy |
36 | | - run: cargo clippy --all-targets --all-features -- -D warnings |
37 | | - eslint: |
38 | | - enabled: true |
39 | | - direct_configs: |
40 | | - - .eslintrc.* |
41 | | - - eslint.config.* |
42 | | - golangci-lint: |
43 | | - enabled: true |
44 | | - direct_configs: |
45 | | - - .golangci.yml |
46 | | - - .golangci.yaml |
47 | | - mypy: |
48 | | - enabled: true |
49 | | - commands: |
50 | | - - name: mypy |
51 | | - run: mypy --ignore-missing-imports ${target} |
52 | | - ruff: |
53 | | - enabled: true |
54 | | - commands: |
55 | | - - name: ruff |
56 | | - run: ruff check --output-format=github ${target} |
57 | | - direct_configs: |
58 | | - - ruff.toml |
59 | | - - pyproject.toml |
60 | | - shellcheck: |
61 | | - enabled: true |
62 | | - taplo: |
63 | | - enabled: true |
64 | | - yamllint: |
65 | | - enabled: true |
| 23 | +lint: |
| 24 | + # Repo-specific command overrides merged over the plugin definitions. |
| 25 | + definitions: |
| 26 | + # black: enforce 100-char line length in both lint and format modes. |
| 27 | + - name: black |
| 28 | + commands: |
| 29 | + - name: lint |
| 30 | + output: pass_fail |
| 31 | + run: black --check --line-length 100 ${target} |
| 32 | + success_codes: [0, 1] |
| 33 | + - name: format |
| 34 | + output: rewrite |
| 35 | + run: black --line-length 100 ${target} |
| 36 | + success_codes: [0] |
| 37 | + batch: true |
| 38 | + in_place: true |
| 39 | + formatter: true |
| 40 | + # clippy: lint all targets/features and fail on any warning. |
| 41 | + - name: clippy |
| 42 | + commands: |
| 43 | + - name: lint |
| 44 | + output: clippy |
| 45 | + target: ${parent_with(Cargo.toml)} |
| 46 | + run: cargo clippy --message-format json --all-targets --all-features --locked -- -D warnings |
| 47 | + success_codes: [0, 101, 383] |
| 48 | + disable_upstream: true |
66 | 49 |
|
67 | | -# Formatters |
68 | | -formatters: |
69 | | - black: |
70 | | - enabled: true |
71 | | - commands: |
72 | | - - name: black |
73 | | - run: black --line-length 100 ${target} |
74 | | - direct_configs: |
75 | | - - pyproject.toml |
76 | | - prettier: |
77 | | - enabled: true |
78 | | - direct_configs: |
79 | | - - .prettierrc |
80 | | - - prettier.config.* |
81 | | - rustfmt: |
82 | | - enabled: true |
83 | | - commands: |
84 | | - - name: rustfmt |
85 | | - run: rustfmt ${target} |
| 50 | + # Enabled tools (plugin defaults unless overridden above). |
| 51 | + enabled: |
| 52 | + - actionlint |
| 53 | + - black |
| 54 | + - clippy |
| 55 | + - eslint |
| 56 | + - golangci-lint |
| 57 | + - mypy |
| 58 | + - prettier |
| 59 | + - ruff |
| 60 | + - rustfmt |
| 61 | + - shellcheck |
| 62 | + - taplo |
| 63 | + - yamllint |
86 | 64 |
|
87 | | -# Actions (CI optimization) |
| 65 | +# Git hooks: run `trunk check` before `git push`. |
88 | 66 | actions: |
89 | | - trunk-check: |
90 | | - enabled: true |
91 | | - size: 5GB |
92 | | - memory: 16GB |
93 | | - disk: 10GB |
94 | | - trunk-merge: |
95 | | - enabled: true |
96 | | - size: 5GB |
97 | | - trunk-push: |
98 | | - enabled: true |
99 | | - size: 5GB |
100 | | - |
101 | | -# Caching |
102 | | -cache: |
103 | | - enabled: true |
104 | | - storage: local |
105 | | - |
106 | | -# CLI |
107 | | -cli: |
108 | | - version: 1.22.2 |
109 | | - |
110 | | -# Environment |
111 | | -env: |
112 | | - variables: |
113 | | - EDITOR: vim |
| 67 | + enabled: |
| 68 | + - trunk-check-pre-push |
0 commit comments