Skip to content

Commit

Permalink
Luacheck
Browse files Browse the repository at this point in the history
  • Loading branch information
p3lim committed Feb 9, 2024
1 parent fe865f9 commit f61e2fd
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint

on:
- push
- pull_request

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Run luacheck
uses: nebularg/actions-luacheck@v1
with:
annotate: warning
args: --no-color
63 changes: 63 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
std = 'lua51'

quiet = 1 -- suppress report output for files without warnings

-- see https://luacheck.readthedocs.io/en/stable/warnings.html#list-of-warnings
-- and https://luacheck.readthedocs.io/en/stable/cli.html#patterns
ignore = {
'212/self', -- unused argument self
'212/event', -- unused argument event
'212/unit', -- unused argument unit
'212/element', -- unused argument element
'312/event', -- unused value of argument event
'312/unit', -- unused value of argument unit
'431', -- shadowing an upvalue
'614', -- trailing whitespace in comment (we use this for docs)
'631', -- line is too long
}

globals = {
-- FrameXML objects we mutate
'SlashCmdList', -- FrameXML/ChatFrame.lua
}

read_globals = {
table = {fields = {'wipe'}},

-- FrameXML objects
'DEFAULT_CHAT_FRAME', -- FrameXML/ChatFrame.lua

-- FrameXML functions
'DisplayTableInspectorWindow', -- AddOns/Blizzard_DebugTools/Blizzard_TableInspector.lua
'UIParentLoadAddOn', -- FrameXML/UIParent.lua
'nop', -- FrameXML/UIParent.lua

-- SharedXML objects
'MinimalSliderWithSteppersMixin', -- SharedXML/Slider/MinimalSlider.lua
'Settings', -- SharedXML/Settings/Blizzard_Settings.lua
'SettingsPanel', -- SharedXML/Settings/Blizzard_SettingsPanel.xml

-- SharedXML functions
'DevTools_Dump', -- SharedXML/Dump.lua
'GenerateClosure', -- SharedXML/FunctionUtil.lua
'Mixin', -- SharedXML/Mixin.lua

-- namespaces
'C_AddOns',
'C_CVar',
'C_EventUtils',
'C_Map',
'C_UnitAuras',

-- API
'CombatLogGetCurrentEventInfo',
'CreateFrame',
'GetBuildInfo',
'GetLocale',
'InCombatLockdown',
'IsAddOnLoaded', -- until wrath classic bumps API
'UnitAuraSlots',
'UnitGUID',
'UnitIsOwnerOrControllerOfUnit',
'UnitIsUnit',
}
2 changes: 1 addition & 1 deletion modules/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function eventMixin:IsUnitEventRegistered(event, ...)
assert(IsUnitEventValid(event, unit), 'event is not valid for the given unit')

if unitEventCallbacks[unit] and unitEventCallbacks[unit][event] then
for index, data in next, unitEventCallbacks[unit][event] do
for _, data in next, unitEventCallbacks[unit][event] do
if data.callback == callback then
return true
end
Expand Down
2 changes: 1 addition & 1 deletion modules/settings/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function addon:RegisterSettings(savedvariable, settings)
internalRegisterSettings(savedvariable, settings)
else
-- don't abuse OnLoad internally
addon:RegisterEvent('ADDON_LOADED', function(self, name)
addon:RegisterEvent('ADDON_LOADED', function(_, name)
if name == addonName then
internalRegisterSettings(savedvariable, settings)
return true -- unregister
Expand Down
2 changes: 1 addition & 1 deletion modules/settings/savedvariables.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local addonName, addon = ...
local _, addon = ...

-- callback system that addons can use to detect when the player changes
-- any setting, but also used internally to update the settings panel
Expand Down

0 comments on commit f61e2fd

Please sign in to comment.