mirror of https://github.com/lcpz/lain.git
luacheck: add global objects, ignore W131 only
Inspired by AwesomeWM's luacheckrc: https://github.com/awesomeWM/awesome/blob/master/.luacheckrc Signed-off-by: Luca Capezzuto <luca.cpz@gmail.com>
This commit is contained in:
parent
c7c50bbf8c
commit
1703661273
20
.luacheckrc
20
.luacheckrc
|
@ -1,13 +1,27 @@
|
||||||
codes = true
|
-- Only allow symbols available in all Lua versions
|
||||||
|
std = "min"
|
||||||
|
|
||||||
allow_defined = true
|
allow_defined = true
|
||||||
max_line_length = false
|
max_line_length = false
|
||||||
|
cache = true
|
||||||
|
|
||||||
|
-- Global objects defined by the C code
|
||||||
|
read_globals = {
|
||||||
|
"awesome",
|
||||||
|
"mousegrabber",
|
||||||
|
"table.unpack",
|
||||||
|
"unpack",
|
||||||
|
"utf8"
|
||||||
|
}
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
"client", "screen", "mouse"
|
"client",
|
||||||
|
"mouse",
|
||||||
|
"root",
|
||||||
|
"screen"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- https://luacheck.readthedocs.io/en/stable/warnings.html
|
-- https://luacheck.readthedocs.io/en/stable/warnings.html
|
||||||
ignore = {
|
ignore = {
|
||||||
"113",
|
|
||||||
"131"
|
"131"
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ local io = { lines = io.lines,
|
||||||
open = io.open }
|
open = io.open }
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local rawget = rawget
|
local rawget = rawget
|
||||||
local table = { sort = table.sort, unpack = table.unpack }
|
local tsort = table.sort
|
||||||
local unpack = unpack or table.unpack -- lua 5.1 retro-compatibility
|
local unpack = unpack or table.unpack -- lua 5.1 retro-compatibility
|
||||||
|
|
||||||
-- Lain helper functions for internal use
|
-- Lain helper functions for internal use
|
||||||
|
@ -164,7 +164,7 @@ function helpers.spairs(t)
|
||||||
local keys = {}
|
local keys = {}
|
||||||
for k in pairs(t) do keys[#keys+1] = k end
|
for k in pairs(t) do keys[#keys+1] = k end
|
||||||
|
|
||||||
table.sort(keys)
|
tsort(keys)
|
||||||
|
|
||||||
-- return the iterator function
|
-- return the iterator function
|
||||||
local i = 0
|
local i = 0
|
||||||
|
|
Loading…
Reference in New Issue