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:
Luca Capezzuto 2022-06-11 12:25:17 +02:00
parent c7c50bbf8c
commit 1703661273
No known key found for this signature in database
GPG Key ID: 35B564C871E7EFEA
2 changed files with 27 additions and 13 deletions

View File

@ -1,13 +1,27 @@
codes = true
-- Only allow symbols available in all Lua versions
std = "min"
allow_defined = true
max_line_length = false
cache = true
-- Global objects defined by the C code
read_globals = {
"awesome",
"mousegrabber",
"table.unpack",
"unpack",
"utf8"
}
globals = {
"client", "screen", "mouse"
"client",
"mouse",
"root",
"screen"
}
-- https://luacheck.readthedocs.io/en/stable/warnings.html
ignore = {
"113",
"131"
}

View File

@ -5,15 +5,15 @@
--]]
local spawn = require("awful.spawn")
local timer = require("gears.timer")
local debug = require("debug")
local io = { lines = io.lines,
open = io.open }
local pairs = pairs
local rawget = rawget
local table = { sort = table.sort, unpack = table.unpack }
local unpack = unpack or table.unpack -- lua 5.1 retro-compatibility
local spawn = require("awful.spawn")
local timer = require("gears.timer")
local debug = require("debug")
local io = { lines = io.lines,
open = io.open }
local pairs = pairs
local rawget = rawget
local tsort = table.sort
local unpack = unpack or table.unpack -- lua 5.1 retro-compatibility
-- Lain helper functions for internal use
-- lain.helpers
@ -164,7 +164,7 @@ function helpers.spairs(t)
local keys = {}
for k in pairs(t) do keys[#keys+1] = k end
table.sort(keys)
tsort(keys)
-- return the iterator function
local i = 0