From 1fea92f1d9908eaa5eb8bafe08b4293d7aadaa55 Mon Sep 17 00:00:00 2001 From: Ondrej Brablc Date: Thu, 19 Dec 2024 12:00:55 +0100 Subject: [PATCH] terraform: replace changing of cwd with file argument (#694) `terraform validate` starts validation from the cwd (unless `-chdir` is used), when we want to validate just some file (actually directory as it cannot validate just one file), instead of changing cwd we have to pass it as an argument. --- lua/lint/linters/terraform_validate.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/lint/linters/terraform_validate.lua b/lua/lint/linters/terraform_validate.lua index 04fa94a7..e23f68c4 100644 --- a/lua/lint/linters/terraform_validate.lua +++ b/lua/lint/linters/terraform_validate.lua @@ -7,12 +7,11 @@ local terraform_severity_to_diagnostic_severity = { return function() return { cmd = 'terraform', - args = { 'validate', '-json' }, + args = { 'validate', '-json', vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ':.:h') }, append_fname = false, stdin = false, stream = 'both', ignore_exitcode = true, - cwd = vim.fs.dirname(vim.api.nvim_buf_get_name(0)), parser = function(output, bufnr) local decoded = vim.json.decode(output) or {} local diagnostics = decoded['diagnostics'] or {}