add markdown to checks
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
parent
61c38bba3c
commit
9de0a2c595
@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env ruby
|
|
||||||
|
|
||||||
all
|
|
||||||
rule 'MD007', :indent => 2
|
|
||||||
rule 'MD013', :tables => false
|
|
122
checks.nix
122
checks.nix
@ -4,65 +4,73 @@
|
|||||||
formatter,
|
formatter,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
forEachSystem (system: {
|
forEachSystem (
|
||||||
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
|
system:
|
||||||
src = ./.;
|
let
|
||||||
hooks = {
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||||
# nix checks
|
in
|
||||||
# Example custom hook for nix formatting
|
{
|
||||||
fmt-check = {
|
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
|
||||||
enable = true;
|
src = ./.;
|
||||||
|
hooks = {
|
||||||
|
# nix checks
|
||||||
|
# Example custom hook for nix formatting
|
||||||
|
fmt-check = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
# The command to execute (mandatory):
|
# The command to execute (mandatory):
|
||||||
entry = "${formatter.${system}}/bin/nixfmt --check";
|
entry = "${formatter.${system}}/bin/nixfmt --check";
|
||||||
|
|
||||||
# The pattern of files to run on (default: "" (all))
|
# The pattern of files to run on (default: "" (all))
|
||||||
# see also https://pre-commit.com/#hooks-files
|
# see also https://pre-commit.com/#hooks-files
|
||||||
files = "\\.nix$";
|
files = "\\.nix$";
|
||||||
};
|
|
||||||
## static analysis checks for nix
|
|
||||||
nil.enable = true;
|
|
||||||
statix.enable = true;
|
|
||||||
deadnix = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
noUnderscore = true; # ignore variables starting with underscore
|
|
||||||
# ignore lambda patterns (useful for passing args from ({}@args)
|
|
||||||
# to other functions)
|
|
||||||
noLambdaPatternNames = true;
|
|
||||||
};
|
};
|
||||||
|
## static analysis checks for nix
|
||||||
|
nil.enable = true;
|
||||||
|
statix.enable = true;
|
||||||
|
deadnix = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
noUnderscore = true; # ignore variables starting with underscore
|
||||||
|
# ignore lambda patterns (useful for passing args from ({}@args)
|
||||||
|
# to other functions)
|
||||||
|
noLambdaPatternNames = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# json hooks
|
||||||
|
check-json = {
|
||||||
|
enable = true;
|
||||||
|
# exclude vscode json files as they allow comments and check-json doesn't
|
||||||
|
excludes = [ "settings.json$" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# toml hooks
|
||||||
|
check-toml.enable = true;
|
||||||
|
|
||||||
|
# markdown hooks
|
||||||
|
mdl = {
|
||||||
|
enable = true;
|
||||||
|
settings.style =
|
||||||
|
(pkgs.writeText ".mdl_style.rb" ''
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
all
|
||||||
|
rule 'MD013', :tables => false
|
||||||
|
'').outPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
# git hooks
|
||||||
|
check-merge-conflicts.enable = true;
|
||||||
|
## prevents committing to main
|
||||||
|
no-commit-to-branch.enable = true;
|
||||||
|
|
||||||
|
# misc hooks
|
||||||
|
check-added-large-files.enable = true;
|
||||||
|
## prevents two similarly named files for case sensitive systems
|
||||||
|
check-case-conflicts.enable = true;
|
||||||
|
detect-private-keys.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# json hooks
|
|
||||||
check-json = {
|
|
||||||
enable = true;
|
|
||||||
# exclude vscode json files as they allow comments and check-json doesn't
|
|
||||||
excludes = [ "settings.json$" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# toml hooks
|
|
||||||
check-toml.enable = true;
|
|
||||||
|
|
||||||
# markdown hooks
|
|
||||||
mdl = {
|
|
||||||
enable = true;
|
|
||||||
settings.rules = [
|
|
||||||
"all"
|
|
||||||
"rule 'MD007', :indent => 2"
|
|
||||||
"rule 'MD013', :tables => false"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# git hooks
|
|
||||||
check-merge-conflicts.enable = true;
|
|
||||||
## prevents committing to main
|
|
||||||
no-commit-to-branch.enable = true;
|
|
||||||
|
|
||||||
# misc hooks
|
|
||||||
check-added-large-files.enable = true;
|
|
||||||
## prevents two similarly named files for case sensitive systems
|
|
||||||
check-case-conflicts.enable = true;
|
|
||||||
detect-private-keys.enable = true;
|
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
})
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user