Skip to content

Commit 2c387b0

Browse files
authored
feat: pretty output (#102)
1 parent 35b567b commit 2c387b0

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

bin/lua-typecheck-action.lua

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,19 @@ local function lint(directory)
5757
}
5858
local stdout_file = 'stdout.txt'
5959
local stderr_file = 'stderr.txt'
60-
local logpath = '.'
61-
local cmd = 'lua-language-server --check '
60+
local cmd = 'lua-language-server --check_format=pretty --check '
6261
.. directory
6362
.. (args.configpath and ' --configpath=' .. args.configpath or '')
64-
.. ' --logpath='
65-
.. logpath
6663
.. ' --checklevel='
6764
.. args.checklevel
6865
local redirect = ' >' .. stdout_file .. ' 2>' .. stderr_file
6966
print(cmd)
7067
local exit_code = os.execute(cmd .. redirect)
71-
local stdout = read_file(stderr_file) or ''
72-
print(stdout)
68+
local stdout = read_file(stdout_file) or ''
7369
if exit_code ~= 0 then
7470
local stderr = read_file(stderr_file) or ''
75-
print(stderr)
76-
error('Failed to call lua-language-server. Exit code: ' .. exit_code)
77-
end
78-
local logfile = logpath .. '/check.json'
79-
local diagnostics = read_file(logfile)
80-
if diagnostics and diagnostics ~= '' then
81-
result.success = false
82-
result.diagnostics = diagnostics
71+
result.success = false;
72+
result.diagnostics = stdout .. '\n\n' .. stderr
8373
return result
8474
end
8575
result.success = true

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stderr.txt

Whitespace-only changes.

stdout.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)