Skip to content

Commit 66fa8c3

Browse files
committed
chore: add pre-commit hooks
1 parent f73064d commit 66fa8c3

File tree

7 files changed

+30
-21
lines changed

7 files changed

+30
-21
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
format:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v3
17-
- uses: Swatinem/rust-cache@v2
18-
- uses: actions-rs/toolchain@v1
19-
with:
20-
toolchain: stable
21-
components: rustfmt
22-
- run: cargo fmt --all -- --check
23-
2413
lint:
2514
runs-on: ubuntu-latest
2615
steps:
@@ -30,8 +19,9 @@ jobs:
3019
with:
3120
toolchain: stable
3221
components: clippy
33-
- run: cargo clippy --all-targets -- -D warnings
34-
- run: cargo clippy --all-targets -- -D warnings --cfg codspeed
22+
- uses: pre-commit/[email protected]
23+
with:
24+
extra_args: --all-files
3525

3626
tests:
3727
runs-on: ubuntu-latest
@@ -62,4 +52,4 @@ jobs:
6252
with:
6353
run: cargo codspeed run
6454
token: ${{ secrets.CODSPEED_TOKEN }}
65-
upload_url: https://api.staging.preview.codspeed.io/upload
55+
upload_url: https://api.staging.preview.codspeed.io/upload

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v2.4.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/doublify/pre-commit-rust
12+
rev: v1.0
13+
hooks:
14+
- id: fmt
15+
args: [--all, --]
16+
- id: cargo-check
17+
args: [--all-targets]
18+
- id: cargo-check
19+
args: [--all-targets, --config, codspeed=true]
20+
- id: clippy
21+
args: [--all-targets, --, -D, warnings]
22+
- id: clippy
23+
args: [--all-targets, --, -D, warnings, --cfg, codspeed]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Cargo.lock
2-
target/
2+
target/

crates/cargo-codspeed/tests/simple.in/benches/another_bencher_example.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
use codspeed::codspeed::black_box;
42
use codspeed_bencher_compat::{benchmark_group, benchmark_main, Bencher};
53

crates/cargo-codspeed/tests/simple.in/benches/bencher_example.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
use codspeed::codspeed::black_box;
42
use codspeed_bencher_compat::{benchmark_group, benchmark_main, Bencher};
53

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Cargo.lock
2-
target/
2+
target/

crates/criterion_compat/benches/criterion_integration/external_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ def benchmark():
3333
sys.stdout.flush()
3434

3535

36-
benchmark()
36+
benchmark()

0 commit comments

Comments
 (0)