-
-
Notifications
You must be signed in to change notification settings - Fork 355
Feature request: Improve usability of standalone diagnosis report #2830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Someone already did this, in a tool called llscheck |
I would like to share my ci step as well, which only uses - name: Run LuaLS
run: |
${LUALS_PATH}/bin/lua-language-server --check=. --num_threads=2 --checklevel=Error
# annotate result
LUALS_RESULT_FILE=${LUALS_PATH}/log/check.json
jq -r '
to_entries[] |
(.key | sub("^.*?\\./"; "")) as $file |
.value[] |
.code as $title |
(.range.start.line + 1) as $line |
(.range.start.character + 1) as $col |
.message as $message |
"\($file):\($line):\($col)::\($message)\n" +
"::error file=\($file),line=\($line),col=\($col),title=\($title)::\($message)"
' ${LUALS_RESULT_FILE}
# exit error if any
if [ $(jq -r 'length' ${LUALS_RESULT_FILE}) -gt 0 ]; then
exit 1
fi
|
@tomlau10 wow, thanks a lot! Both solutions look very good, that's exactly what I was looking for :-) |
Yes
{
"filename1": [
<result1>,
<result2>,
...
],
...
}
[
{
"key": "filename1",
"value": [ <result>, ...]
},
...
]
In pseudo code, it can be interpreted as: for _, entry in ipairs(to_entries(data)) do -- to_entries[]
local file = entry.key
for _, v in ipairs(entry.value) do -- .value[]
local title, line, col, message = v.code, v.line, v.col, v.message
print(file, title, line, col, message)
end
end There is a |
@kaklakariada Could you re-open the issue? Even if it has workarounds, it would be nice if LuaLS provided a "linter mode" ready to be used in CI/CD pipelines. |
If you only care about the exit code, this could be simplified to: lua-language-server \
--configpath .luarc.json \
--logpath . \
--loglevel error \
--checklevel Hint \
--check .
test "$(jq 'to_entries|length' check.json)" -gt 0 |
Thanks a lot for LuaLS, this is a really great project!
We are running LuaLS during the CI build to check type annotations using the
--check
command line option.I would like to propose two usability improvements for the
--check
mode:Exit code
The program should exit with a status code other than
0
when it finds problems.0
even if it finds problems. This would simplify checking build success or failure.Log problems
The program should log each problem to stdout or stderr
check.json
which is hard to readThe text was updated successfully, but these errors were encountered: