Skip to content

Commit 0cb0497

Browse files
committed
Add pre-commit config.
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
1 parent 1f65e1c commit 0cb0497

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
name: Pre-commit
2+
13
on:
24
pull_request:
3-
push:
45

56
jobs:
67
main:
78
runs-on: ubuntu-latest
89
steps:
910
- uses: actions/checkout@v3
11+
- uses: oven-sh/setup-bun@v2
1012
- uses: actions-rust-lang/setup-rust-toolchain@v1
1113
with:
1214
toolchain: 1.81.0
@@ -17,4 +19,4 @@ jobs:
1719
- uses: Swatinem/rust-cache@v2
1820
- uses: pre-commit/action@v3.0.1
1921
- uses: pre-commit-ci/lite-action@v1.0.3
20-
if: always()
22+
if: always()

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
default_language_version:
4+
rust: 1.81.0
5+
repos:
6+
- repo: local
7+
hooks:
8+
- id: cargo-clippy
9+
name: Clippy Fixes
10+
description: Run the Clippy linter on the package.
11+
entry: cargo clippy --fix
12+
language: rust
13+
files: \.rs$
14+
pass_filenames: false
15+
- id: cargo-fmt
16+
name: Cargo Format
17+
description: Run the Formatter
18+
entry: cargo fmt --all
19+
language: rust
20+
files: \.rs$
21+
pass_filenames: false
22+
- repo: https://github.com/pre-commit/pre-commit-hooks
23+
rev: v3.2.0
24+
hooks:
25+
- id: trailing-whitespace
26+
# Can't mess with these files, will break migrations
27+
exclude: 'crates/pipeline-manager/migrations/.*|.*\.patch|.*\.svg'
28+
- repo: local
29+
hooks:
30+
- id: update-openapi
31+
name: Update OpenAPI
32+
entry: cargo run --bin=pipeline-manager -- --dump-openapi
33+
language: system
34+
files: \.rs$
35+
pass_filenames: false

0 commit comments

Comments
 (0)