From 51605d94ce4c8741c45a7217f94a24f353bf8071 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Tue, 20 Aug 2024 22:32:18 +0200 Subject: [PATCH] fix(lua-ls): only fail if there are diagnostics --- modules/hooks.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index bbebdbd5..6762ab84 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -2612,7 +2612,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol }; script = pkgs.writeShellApplication { name = "lua-ls-lint"; - runtimeInputs = [ hooks.lua-ls.package ]; + runtimeInputs = [ hooks.lua-ls.package pkgs.jq ]; checkPhase = ""; # The default checkPhase depends on GHC text = '' set -e @@ -2624,7 +2624,10 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol if [[ -f $logpath/check.json ]]; then echo "+++++++++++++++ lua-language-server diagnostics +++++++++++++++" cat $logpath/check.json - exit 1 + diagnostic_count=$(jq 'length' $logpath/check.json) + if [ "$diagnostic_count" -gt 0 ]; then + exit 1 + fi fi ''; };