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"
|
||||||
}
|
}
|
||||||
|
|
20
helpers.lua
20
helpers.lua
|
@ -5,15 +5,15 @@
|
||||||
|
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local spawn = require("awful.spawn")
|
local spawn = require("awful.spawn")
|
||||||
local timer = require("gears.timer")
|
local timer = require("gears.timer")
|
||||||
local debug = require("debug")
|
local debug = require("debug")
|
||||||
local io = { lines = io.lines,
|
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
|
||||||
-- lain.helpers
|
-- lain.helpers
|
||||||
|
@ -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