Skip to content

Commit

Permalink
Check for leftover white space
Browse files Browse the repository at this point in the history
Agda stdlib team recommends to run
[fix-whitespace](https://github.com/agda/agda-stdlib/blob/master/HACKING.md#how-to-enforce-whitespace-policies)
in order to get rid of unnecessary white space characters.  I've added
this tool to the nix dev shell, as well as formed a check that will be
can be run with `nix flake check` command.  As of now this is entirely
opt-in as this check is not enabled in (and thus won't fail) the CI.
  • Loading branch information
jkopanski committed Feb 6, 2024
1 parent f01a6ba commit 2e7c521
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions fix-whitespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
included-dirs:
- src

included-files:
- "*.agda"
- "*.md"
- "*.org"
- "*.nix"

excluded-dirs:
- .git
- .direnv
- result
14 changes: 13 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,22 @@
agdaWithStandardLibrary = pkgs.agda.withPackages (_: [ standard-library ]);

in {
devShell = pkgs.mkShell {
checks.whitespace = pkgs.stdenvNoCC.mkDerivation {
name = "check-whitespace";
dontBuild = true;
src = ./.;
doCheck = true;
checkPhase = ''
${pkgs.haskellPackages.fix-whitespace}/bin/fix-whitespace --check
'';
installPhase = ''mkdir "$out"'';
};

devShells.default = pkgs.mkShell {
buildInputs = [
agdaWithStandardLibrary
pkgs.graphviz
pkgs.haskellPackages.fix-whitespace
];
};

Expand Down

0 comments on commit 2e7c521

Please sign in to comment.