Questions tagged [luacheck]

Luacheck is a linter for Lua programs.

Luacheck is a linter for Lua programs.

https://github.com/mpeterv/luacheck/

6 questions
6
votes
4 answers

How to ignore Luacheck warnings?

The Luacheck linter produces a warning when an if statement branch doesn't include any statements. For example, if I have a file called test.lua with the following code local function f(x) if x == "hello" then -- nothing to do elseif…
hugomg
  • 68,213
  • 24
  • 160
  • 246
3
votes
1 answer

How to make warning in luacheck as error?

I want luacheck treat "accessing undefined variable 'variable' " warning as error, which ALWAYS make sense for me. so how can I config specific warning , let's say W113 as errors, so I can find them at a glance
Liu Hao
  • 472
  • 4
  • 24
2
votes
1 answer

Lua - Should I use ":" when defining functions in tables if not using the "self" keyword?

This is more of a design philosophy question as I already know you shouldn't call a function with : (object-oriented syntactic sugar) if the function has been defined without the self keyword by using .. But the problem is that programmers using a…
Mayron
  • 2,146
  • 4
  • 25
  • 51
1
vote
1 answer

How to avoid luacheck warning "setting undefined field of global"

When writing Lua code, I felt that the built-in methods for string were a bit lacking. So I added this function to the string class. ---@param self string function string:firstToUpper() -- setting undefined field 'firstToUpper' of global…
0
votes
1 answer

luacheck: ignore globals defined in file

I have a module constants.lua that has a lot of globals defined. How can I ignore all of these in luacheck? I assume I can build logic to do this inside my .luacheckrc: load constants.lua, see what it added to _G, and then add those to…
idbrii
  • 10,975
  • 5
  • 66
  • 107
0
votes
1 answer

Luacheck include files from exclude directory

I have a project like this (in fact, there are more files and dirs): . ├── src │ ├── main.lua │ └── smth.lua └── tests ├── others │ ├── others_1.lua │ ├── others_2.lua │ └── others_3.lua ├── speed_tests │ ├──…
A.Starshov
  • 39
  • 6