add Vale for prose linting
All checks were successful
checks / checks-impure (pull_request) Successful in 2m16s

This commit is contained in:
Valentin Gagarin 2024-05-15 18:37:05 +02:00
parent bfe37c2457
commit 5dcbd6e225

View File

@ -46,5 +46,55 @@
];
includes = [ "*.py" ];
};
treefmt.settings.formatter.vale =
with pkgs;
let
vocab = "cLAN";
style = "Docs";
config = writeText "vale.ini" ''
StylesPath = ${styles}
Vocab = ${vocab}
[*.md]
BasedOnStyles = Vale, ${style}
'';
styles = symlinkJoin {
name = "vale-style";
paths = [
accept
reject
headings
];
};
accept = writeTextDir "config/vocabularies/${vocab}/accept.txt" ''
cLAN
Nix
NixOS
Nixpkgs
'';
reject = writeTextDir "config/vocabularies/${vocab}/ignore.txt" ''
Clan
'';
headings = writeTextDir "${style}/headings.yml" ''
extends: capitalization
message: "'%s' should be in sentence case"
level: error
scope: heading
# $title, $sentence, $lower, $upper, or a pattern.
match: $sentence
'';
in
{
command = "${vale}/bin/vale";
options = [ "--config=${config}" ];
includes = [ "*.md" ];
# TODO: too much at once, fix piecemeal
excludes = [
"README.md"
"docs/*"
"clanModules/*"
"pkgs/*"
];
};
};
}