Skip to content

Commit

Permalink
chore: add pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nydragon committed May 24, 2024
1 parent fb2db67 commit 8b0cb60
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
default_install_hook_types:
- pre-commit
- commit-msg

repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.2
hooks:
- id: gitleaks

- repo: local
hooks:
- id: committed
name: Lint commit message
entry: committed
language: system
files: .*
args: [--fixup, --wip, --commit-file]
stages: [commit-msg]

- id: fmt
name: Lint Check
entry: cargo
language: system
files: .*
args: [fmt, --check]
pass_filenames: false
stages: [commit]

- id: clippy
name: Check clippy suggestions
entry: cargo
language: system
files: .*
args: [clippy]
pass_filenames: false
stages: [commit]
20 changes: 20 additions & 0 deletions committed.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
subject_length = 100
subject_capitalized = false
subject_not_punctuated = true
imperative_subject = true
no_fixup = true
no_wip = true
hard_line_length = 0
line_length = 120
style = "conventional"
allowed_types = [
"fix",
"feat",
"chore",
"docs",
"style",
"refactor",
"perf",
"test",
]
merge_commit = true
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
buildInputs = [
(rustVersion.override { extensions = [ "rust-src" ]; })
pkgs.git-cliff
pkgs.committed
];
shellHook =
let
Expand All @@ -61,6 +62,8 @@
echo "Use ${rofiDebug} to build and run the debuging version with rofi."
echo "Use ${rofiRelease} to build and run the release version with rofi."
${pkgs.pre-commit}/bin/pre-commit install -f
'';
};
}
Expand Down

0 comments on commit 8b0cb60

Please sign in to comment.