Compare commits
10 commits
14b3e118cf
...
8a4dc8f9e9
Author | SHA1 | Date | |
---|---|---|---|
Evie Litherland-Smith | 8a4dc8f9e9 | ||
Evie Litherland-Smith | c49533da57 | ||
Evie Litherland-Smith | f36cc0cef4 | ||
Evie Litherland-Smith | d34174a339 | ||
Evie Litherland-Smith | aea20cf13c | ||
Evie Litherland-Smith | 84fde91c3e | ||
eeee35a89e | |||
79fb5df709 | |||
0c016cee78 | |||
ba88882ecb |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/.direnv/
|
|
@ -1,21 +1,29 @@
|
|||
- id: fmt
|
||||
name: fmt
|
||||
description: Format files with cargo fmt.
|
||||
entry: cargo fmt
|
||||
language: system
|
||||
types: [rust]
|
||||
args: ['--']
|
||||
- id: cargo-check
|
||||
name: cargo check
|
||||
description: Check the package for errors.
|
||||
entry: cargo check
|
||||
language: system
|
||||
types: [rust]
|
||||
pass_filenames: false
|
||||
- id: clippy
|
||||
name: clippy
|
||||
description: Lint rust sources
|
||||
entry: cargo clippy -- -D warnings
|
||||
language: system
|
||||
types: [rust]
|
||||
pass_filenames: false
|
||||
- id: fmt
|
||||
name: fmt
|
||||
description: Format files with cargo fmt.
|
||||
entry: cargo fmt
|
||||
language: system
|
||||
types: [rust]
|
||||
args: ["--"]
|
||||
- id: cargo-check
|
||||
name: cargo check
|
||||
description: Check the package for errors.
|
||||
entry: cargo check
|
||||
language: system
|
||||
types: [rust]
|
||||
pass_filenames: false
|
||||
- id: cargo-clippy
|
||||
name: cargo clippy
|
||||
description: Lint rust sources
|
||||
entry: cargo clippy
|
||||
language: system
|
||||
args: ["--", "-D", "warnings"]
|
||||
types: [rust]
|
||||
pass_filenames: false
|
||||
- id: cargo-test
|
||||
name: cargo test
|
||||
description: Run package tests
|
||||
entry: cargo test
|
||||
language: system
|
||||
args: ["--"]
|
||||
pass_filenames: false
|
||||
|
|
|
@ -5,17 +5,19 @@
|
|||
## Using rust tools with pre-commit
|
||||
|
||||
```yaml
|
||||
- repo: https://github.com/doublify/pre-commit-rust
|
||||
- repo: https://git.xenia.me.uk/utils/pre-commit-rust
|
||||
rev: master
|
||||
hooks:
|
||||
- id: fmt
|
||||
- id: cargo-check
|
||||
- id: cargo-clippy
|
||||
- id: cargo-test
|
||||
```
|
||||
|
||||
## Passing arguments to rustfmt
|
||||
|
||||
```yaml
|
||||
- repo: https://github.com/doublify/pre-commit-rust
|
||||
- repo: https://git.xenia.me.uk/utils/pre-commit-rust
|
||||
rev: master
|
||||
hooks:
|
||||
- id: fmt
|
||||
|
|
61
flake.lock
Normal file
61
flake.lock
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1704008649,
|
||||
"narHash": "sha256-rGPSWjXTXTurQN9beuHdyJhB8O761w1Zc5BqSSmHvoM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d44d59d2b5bd694cd9d996fd8c51d03e3e9ba7f7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701680307,
|
||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
15
flake.nix
Normal file
15
flake.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
description = "Rust tools for pre-commit";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils }:
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = import nixpkgs { inherit system; };
|
||||
in {
|
||||
devShell = pkgs.mkShell { buildInputs = with pkgs; [ pre-commit ]; };
|
||||
});
|
||||
}
|
21
hooks.yaml
21
hooks.yaml
|
@ -1,21 +0,0 @@
|
|||
- id: fmt
|
||||
name: fmt
|
||||
description: Format files with cargo fmt.
|
||||
entry: cargo fmt --
|
||||
language: system
|
||||
files: \.rs$
|
||||
args: []
|
||||
- id: cargo-check
|
||||
name: cargo check
|
||||
description: Check the package for errors.
|
||||
entry: cargo check
|
||||
language: system
|
||||
files: \.rs$
|
||||
pass_filenames: false
|
||||
- id: cargo-clippy
|
||||
name: cargo clippy
|
||||
description: Run the Clippy linter on the package.
|
||||
entry: cargo clippy -- -D warnings
|
||||
language: system
|
||||
files: \.rs$
|
||||
pass_filenames: false
|
Loading…
Reference in a new issue