devos/profiles/develop/kakoune/lint/nix.sh
Timothy DeHerrera 9ba71d5b62
replace nixfmt with nixpkgs-fmt
nixpkgs-fmt looks like it is going to be the standard formatter for
nixpkgs, so we should follow suite.
2020-07-30 22:07:59 -06:00

13 lines
434 B
Bash
Executable file

#!/usr/bin/env zsh
nix-linter -W all $1 2>&1 | < /dev/stdin > /tmp/lint.out
if head -1 /tmp/lint.out | grep Failure &> /dev/null; then
sed -n 2p /tmp/lint.out | tr '\n' ' '
printf "error: "
awk 'NR>5 {printf "%s; ", $0}' /tmp/lint.out
else
awk '{$(NF-1)=""; print $NF ": warning: " $0}' /tmp/lint.out > /tmp/lint.2
awk '{$NF="";gsub(/-[0-9]*:[0-9]*:*/, ":"); print $0}' /tmp/lint.2
fi
rm -f /tmp/lint.out
rm -f /tmp/lint.2