crane/checks/clippy/default.nix
Simon Žlender 9b32adff97
mkDummySrc: ignore clippy warnings in dummyrs (#587)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2024-04-21 03:57:27 +00:00

50 lines
1.0 KiB
Nix

{ buildDepsOnly
, cargoClippy
, crateNameFromCargoToml
, linkFarmFromDrvs
, mkDummySrc
}:
let
src = ./clippytest;
cargoArtifacts = buildDepsOnly {
inherit src;
};
in
linkFarmFromDrvs "clippy-tests" (builtins.attrValues {
clippytest = cargoClippy {
inherit cargoArtifacts src;
};
dummySrc = cargoClippy ((crateNameFromCargoToml { inherit src; }) // {
cargoArtifacts = null;
src = mkDummySrc {
inherit src;
};
});
checkWarnings = cargoClippy {
inherit cargoArtifacts src;
pname = "checkWarnings";
cargoClippyExtraArgs = "--all-targets 2>clippy.log";
installPhaseCommand = ''
grep 'warning: use of `println!`' <clippy.log
mkdir -p $out
'';
};
denyWarnings = cargoClippy {
inherit cargoArtifacts src;
pname = "denyWarnings";
cargoClippyExtraArgs = ''
--all-targets -- --deny warnings 2>clippy.log || [ "0" != "$?" ]
'';
installPhaseCommand = ''
grep 'error: use of `println!`' <clippy.log
mkdir -p $out
'';
};
})