Skip to content
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

Warnings as Errors Request #45

Open
JayMales opened this issue Dec 8, 2021 · 5 comments
Open

Warnings as Errors Request #45

JayMales opened this issue Dec 8, 2021 · 5 comments

Comments

@JayMales
Copy link

JayMales commented Dec 8, 2021

Could I request a command line arg that would treat warnings as errors.

This would be great!

Thanks

@arichard4
Copy link

Can you clarify what you mean by that? Eg is there a specific example you can give? What’s the current warning/error distinction, do you mean syntax errors?

@JayMales
Copy link
Author

JayMales commented Dec 9, 2021

Hey,

So we have been using this app for about 6 months now and we had warnings turn on. We have slowly been removing ALL the warnings and as of today we have finally got rid of them. Lots of these warnings would/could cause massive issues. So from now on we want to enforce warnings as errors. There is options in visual studio to count warnings as errors. That does not work for these projects :\ so it would be nice if we could pass in a command line arg and just treat warnings as errors (but still not include the excluded warnings)

@arichard4
Copy link

Warnings vs. errors are decided on in the function count_warnings_errors in format.lua:

local function count_warnings_errors(events)
   local warnings, errors = 0, 0

   for _, event in ipairs(events) do
      if event.code:sub(1, 1) == "0" then
         errors = errors + 1
      else
         warnings = warnings + 1
      end
   end

   return warnings, errors
end

If you want a quick fix, you can make this function count everything as an error locally.

Longer-term, I don't think an "only errors" mode makes sense, but plausibly luacheck ought to expose a config option for which events are considered errors.

There is options in visual studio to count warnings as errors. That does not work for these projects :\

I'm not sure what you mean by this, but this feels like a separate bug in whatever glue project you are using to link luacheck to visual studio?

@alerque
Copy link
Member

alerque commented Jan 21, 2022

@JayMales What difference does it make to you? Ore you just looking for the exit code or are you parsing the output to read whether it is a warning or error?

@cooljeanius
Copy link

@JayMales What difference does it make to you? Ore you just looking for the exit code or are you parsing the output to read whether it is a warning or error?

At least in my case, it's whichever one of those that GitHub Actions uses to determine whether the workflow failed or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants