Compare commits

...

10 commits

Author SHA1 Message Date
Evie Litherland-Smith 8a4dc8f9e9 Update README to include all hooks as example 2024-01-01 12:00:23 +00:00
Evie Litherland-Smith c49533da57 Rename clippy to cargo-clippy for consistency
Add cargo-test hook to run packages tests
2024-01-01 11:57:42 +00:00
Evie Litherland-Smith f36cc0cef4 Delete hooks.yaml 2024-01-01 11:57:17 +00:00
Evie Litherland-Smith d34174a339 Delete github workflows 2024-01-01 11:57:11 +00:00
Evie Litherland-Smith aea20cf13c Make package a nix flake 2024-01-01 11:56:15 +00:00
Evie Litherland-Smith 84fde91c3e Update repo url in README 2024-01-01 11:45:56 +00:00
Fadi Hadzh eeee35a89e
Merge pull request #11 from waisbrot/auto-tag
Automatically tag every commit to 'master'
2020-09-11 17:04:14 +03:00
Fadi Hadzh 79fb5df709
Merge pull request #12 from Narsil/master
Enabling possibility to add custom arguments to clippy too.
2020-09-11 17:03:48 +03:00
Nicolas Patry 0c016cee78 Enabling possibility to add custom arguments to clippy too. 2020-08-20 09:12:38 +02:00
Nathaniel Waisbrot ba88882ecb Automatically tag every commit to 'master'
Use Github workflow to tag every commit to master. Tags follow
the format v1, v2, v3, etc.

fixes #3
2020-08-12 12:45:39 -04:00
7 changed files with 111 additions and 44 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.direnv/

View file

@ -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

View file

@ -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
View 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
View 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 ]; };
});
}

View file

@ -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