From 4c5c47b5939ab3446ccc2f9cb1de57a1ec47e379 Mon Sep 17 00:00:00 2001 From: Antonio Gurgel Date: Sun, 25 Dec 2022 02:02:01 -0800 Subject: [PATCH] nix: handle versions past 2.9 (#4394) --- ale_linters/nix/nix.vim | 2 +- test/handler/test_nix_handler.vader | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ale_linters/nix/nix.vim b/ale_linters/nix/nix.vim index 7c2ce963..64c95ab9 100644 --- a/ale_linters/nix/nix.vim +++ b/ale_linters/nix/nix.vim @@ -5,7 +5,7 @@ function! ale_linters#nix#nix#Command(buffer, output, meta) abort let l:version = a:output[0][22:] - if l:version =~# '^\(2.[4-9]\|3\).*' + if l:version =~# '^\(2.[4-9]\|2.[1-9][0-9]\+\|3\).*' return 'nix-instantiate --log-format internal-json --parse -' else return 'nix-instantiate --parse -' diff --git a/test/handler/test_nix_handler.vader b/test/handler/test_nix_handler.vader index db6b9a4b..ee02fef2 100644 --- a/test/handler/test_nix_handler.vader +++ b/test/handler/test_nix_handler.vader @@ -85,6 +85,16 @@ Execute(The nix command should add 'log-format' option for nix version 2.9): \ 'nix-instantiate --log-format internal-json --parse -', \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.9.0pre20211206_ignored'], '') +Execute(The nix command should add 'log-format' option for nix version 2.10): + AssertEqual + \ 'nix-instantiate --log-format internal-json --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.10.0pre20221221_ignored'], '') + +Execute(The nix command should add 'log-format' option for nix version 2.20): + AssertEqual + \ 'nix-instantiate --log-format internal-json --parse -', + \ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.20.0pre20221221_ignored'], '') + Execute(The nix command should add 'log-format' option for nix version 3.0): AssertEqual \ 'nix-instantiate --log-format internal-json --parse -',