ci: add lint workflow

This commit is contained in:
Aire-One 2024-10-24 19:49:36 +02:00
parent fae32823a3
commit c5a1de4e2a
8 changed files with 84 additions and 35 deletions

18
.cspell.json Normal file
View File

@ -0,0 +1,18 @@
{
"words": [
"Aire-One",
"capi",
"constructorfct",
"fatalwarnings",
"fullscreen",
"hasitem",
"JohnnyMorganz",
"ldoc",
"luacheck",
"luadoc",
"lunarmodules",
"mousebindings",
"staticfct",
"stylua"
]
}

43
.github/workflows/lint.yaml vendored Normal file
View File

@ -0,0 +1,43 @@
name: Lint
on:
push:
branches:
- $default-branch
pull_request:
jobs:
luacheck:
needs: []
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lunarmodules/luacheck@v1
stylua:
needs: []
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v0.20.0
args: --check .
ldoc:
needs: []
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lunarmodules/ldoc@v1.5.0
with:
args: --fatalwarnings .
spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: streetsidesoftware/cspell-action@v6
with:
incremental_files_only: false

View File

@ -108,7 +108,7 @@ end
-- @tparam string params.signal The signal the slot connects to. -- @tparam string params.signal The signal the slot connects to.
-- @tparam function params.slot The callback function to connect to the signal. -- @tparam function params.slot The callback function to connect to the signal.
-- @tparam table params.slot_params The parameters to pass to the callback -- @tparam table params.slot_params The parameters to pass to the callback
-- function. (The signal will invok the callback function with this table as -- function. (The signal will invoke the callback function with this table as
-- parameter) -- parameter)
-- @tparam[opt=false] boolean params.connect Connect the slot now. -- @tparam[opt=false] boolean params.connect Connect the slot now.
-- @treturn Slot The created Slot instance. -- @treturn Slot The created Slot instance.
@ -201,5 +201,3 @@ function awesome_slot.mt:__call(...) -- luacheck: ignore unused argument self
end end
return setmetatable(awesome_slot, awesome_slot.mt) return setmetatable(awesome_slot, awesome_slot.mt)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,21 +1,19 @@
local client_slots = {} local client_slots = {}
function client_slots.append_mousebindings(params) function client_slots.append_mousebindings(params)
local amouse = require "awful.mouse" local mouse = require "awful.mouse"
for _, bindings in pairs(params.mousebindings) do for _, bindings in pairs(params.mousebindings) do
amouse.append_client_mousebindings(bindings) mouse.append_client_mousebindings(bindings)
end end
end end
function client_slots.append_keybindings(params) function client_slots.append_keybindings(params)
local akeyboard = require "awful.keyboard" local keyboard = require "awful.keyboard"
for _, bindings in pairs(params.keybindings) do for _, bindings in pairs(params.keybindings) do
akeyboard.append_client_keybindings(bindings) keyboard.append_client_keybindings(bindings)
end end
end end
return client_slots return client_slots
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,10 +1,8 @@
local aslot_slots = {} local slots = {}
aslot_slots.client = require "awesome-slot.slots.client" slots.client = require "awesome-slot.slots.client"
aslot_slots.ruled = require "awesome-slot.slots.ruled" slots.ruled = require "awesome-slot.slots.ruled"
aslot_slots.screen = require "awesome-slot.slots.screen" slots.screen = require "awesome-slot.slots.screen"
aslot_slots.tag = require "awesome-slot.slots.tag" slots.tag = require "awesome-slot.slots.tag"
return aslot_slots return slots
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,21 +1,19 @@
local ruled_slots = {} local ruled_slots = {}
function ruled_slots.append_client_rules(params) function ruled_slots.append_client_rules(params)
local rclient = require "ruled.client" local client = require "ruled.client"
for _, rule in pairs(params.rules) do for _, rule in pairs(params.rules) do
rclient.append_rule(rule) client.append_rule(rule)
end end
end end
function ruled_slots.append_notification_rules(params) function ruled_slots.append_notification_rules(params)
local rnotification = require "ruled.notification" local notification = require "ruled.notification"
for _, rule in pairs(params.rules) do for _, rule in pairs(params.rules) do
rnotification.append_rule(rule) notification.append_rule(rule)
end end
end end
return ruled_slots return ruled_slots
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -2,24 +2,22 @@ local screen_slots = {}
function screen_slots.wallpaper(screen, params) function screen_slots.wallpaper(screen, params)
local beautiful = require "beautiful" local beautiful = require "beautiful"
local gwallpaper = require "gears.wallpaper" local wallpaper = require "gears.wallpaper"
params = params or { params = params or {
wallpaper = beautiful.wallpaper, wallpaper = beautiful.wallpaper,
} }
local wallpaper = params.wallpaper local w = params.wallpaper
if wallpaper then if w then
-- If wallpaper is a function, call it with the screen -- If wallpaper is a function, call it with the screen
if type(wallpaper) == "function" then if type(w) == "function" then
wallpaper = wallpaper(screen) w = w(screen)
end end
gwallpaper.maximized(wallpaper, screen, true) wallpaper.maximized(w, screen, true)
end end
end end
return screen_slots return screen_slots
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,11 +1,9 @@
local tag_slots = {} local tag_slots = {}
function tag_slots.default_layouts(params) function tag_slots.default_layouts(params)
local alayout = require "awful.layout" local layout = require "awful.layout"
alayout.append_default_layouts(params.layouts) layout.append_default_layouts(params.layouts)
end end
return tag_slots return tag_slots
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80