Skip to content

Commit

Permalink
luacheck: add global objects, ignore W131 only
Browse files Browse the repository at this point in the history
Inspired by AwesomeWM's luacheckrc:
https://github.com/awesomeWM/awesome/blob/master/.luacheckrc

Signed-off-by: Luca Capezzuto <[email protected]>
  • Loading branch information
lcpz committed Jun 11, 2022
1 parent c7c50bb commit 1703661
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
20 changes: 17 additions & 3 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -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"
}
20 changes: 10 additions & 10 deletions helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1703661

Please sign in to comment.