nix: handle versions past 2.9 (#4394)

This commit is contained in:
Antonio Gurgel 2022-12-25 02:02:01 -08:00 committed by GitHub
parent 87b4ab4e20
commit 4c5c47b593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -5,7 +5,7 @@
function! ale_linters#nix#nix#Command(buffer, output, meta) abort function! ale_linters#nix#nix#Command(buffer, output, meta) abort
let l:version = a:output[0][22:] 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 -' return 'nix-instantiate --log-format internal-json --parse -'
else else
return 'nix-instantiate --parse -' return 'nix-instantiate --parse -'

View File

@ -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 -', \ 'nix-instantiate --log-format internal-json --parse -',
\ ale_linters#nix#nix#Command('', ['nix-instantiate (Nix) 2.9.0pre20211206_ignored'], '') \ 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): Execute(The nix command should add 'log-format' option for nix version 3.0):
AssertEqual AssertEqual
\ 'nix-instantiate --log-format internal-json --parse -', \ 'nix-instantiate --log-format internal-json --parse -',