Skip to content

Commit

Permalink
terraform: replace changing of cwd with file argument (#694)
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
brablc authored Dec 19, 2024
1 parent ac2b56b commit 1fea92f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lua/lint/linters/terraform_validate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down

0 comments on commit 1fea92f

Please sign in to comment.