Skip to content

Commit

Permalink
Add .luacheckrc
Browse files Browse the repository at this point in the history
  • Loading branch information
nebularg committed May 11, 2024
1 parent 7226e05 commit 5acf7ca
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 24 deletions.
81 changes: 81 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
std = "lua51"
max_line_length = false
codes = true
exclude_files = {
"**/libs",
}
ignore = {
"11./SLASH_.*", -- Setting an undefined (Slash handler) global variable
"212", -- Unused argument
"213", -- Unused loop variable
}
globals = {
"BetterAddonListDB",

"AddonCharacterDropDown",
"AddonCharacterDropDownButton",
"AddonList",
"AddonList_Enable",
"AddonList_SetSecurityIcon",
"AddonList_SetStatus",
"AddonListForceLoad",
"AddonTooltip_Update",
"C_AddOns",
"C_Timer",
"CloseDropDownMenus",
"CopyTable",
"CreateFrame",
"GameTooltip",
"GetAddOnMemoryUsage",
"GetLocale",
"hooksecurefunc",
"IsAddonVersionCheckEnabled",
"IsShiftKeyDown",
"PlaySound",
"ResetAddOns",
"SecureCmdOptionParse",
"ShowUIPanel",
"SlashCmdList",
"SOUNDKIT",
"ToggleDropDownMenu",
"UIDropDownMenu_AddButton",
"UIDropDownMenu_CreateInfo",
"UIDropDownMenu_Initialize",
"UIDROPDOWNMENU_MENU_VALUE",
"UIDropDownMenu_SetSelectedValue",
"UnitName",
"UpdateAddOnMemoryUsage",

"tContains",
"tostringall",
"sort",
"wipe",

"ADDON_BANNED_TOOLTIP",
"CANCEL",
"FILTER",
"LOAD_ADDON",
"NONE",
"OKAY",
"YES",
}
files["BetterAddonList.lua"].globals = {
"LibStub",
"AddonList_HasAnyChanged",
"AddonListOkayButton",
"CreateDataProvider",
"CreateIndexRangeDataProvider",
"SearchBoxTemplate_OnTextChanged",
}
files["BetterAddonList_Classic.lua"].globals = {
"AddonList_Update",
"AddonListScrollFrame",
"AddonTooltip_BuildDeps",
"FauxScrollFrame_Update",
"SearchBoxTemplate_OnTextChanged",
"StaticPopup_Show",
"StaticPopupDialogs",
"ADDON_DEPENDENCIES",
"ADDON_BUTTON_HEIGHT",
"MAX_ADDONS_DISPLAYED",
}
17 changes: 4 additions & 13 deletions BetterAddonList.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
-- luacheck: globals BetterAddonListDB SLASH_BETTERADDONLIST1 SLASH_BETTERADDONLIST2 SLASH_BETTERADDONLIST3 SlashCmdList SLASH_RELOADUI1 SLASH_RELOADUI2
-- luacheck: globals UIDropDownMenu_Initialize UIDropDownMenu_CreateInfo UIDropDownMenu_AddButton UIDropDownMenu_SetSelectedValue UIDROPDOWNMENU_MENU_VALUE
-- luacheck: globals SearchBoxTemplate_OnTextChanged IsAddonVersionCheckEnabled ResetAddOns CreateDataProvider CreateIndexRangeDataProvider
-- luacheck: globals AddonList AddonCharacterDropDown AddonCharacterDropDownButton AddonListForceLoad AddonListOkayButton
-- luacheck: globals AddonList_Enable AddonList_SetSecurityIcon AddonList_SetStatus AddonList_HasAnyChanged AddonTooltip_Update
-- luacheck: globals SOUNDKIT
-- luacheck: globals C_AddOns

local ADDON_NAME, ns = ...
BetterAddonListDB = BetterAddonListDB or {}

local LibDialog = LibStub("LibDialog-1.0")
local LibDialog = LibStub("LibDialog-1.0n")

local _G = _G
local GetAddOnMetadata = C_AddOns.GetAddOnMetadata

local L = ns.L
L.LOAD_ADDON = GetLocale() == "ruRU" and "Загрузить" or _G.LOAD_ADDON
L.LOAD_ADDON = GetLocale() == "ruRU" and "Загрузить" or LOAD_ADDON

local UpdateList

Expand Down Expand Up @@ -158,7 +150,6 @@ function addon:PLAYER_LOGIN()
local regions = {AddonListForceLoad:GetRegions()}
regions[1]:SetPoint("LEFT", AddonListForceLoad, "RIGHT", 2, 0)
regions[1]:SetText(L["Load out of date"])
regions = nil

-- let the frame overlap over ui frames
--UIPanelWindows["AddonList"].area = nil
Expand Down Expand Up @@ -635,7 +626,7 @@ do

local memory = owner.memoryUsage
if memory then
local text = ""
local text
if memory > 1000 then
memory = memory / 1000
text = L["Memory: %.02f MB"]:format(memory)
Expand Down Expand Up @@ -779,7 +770,7 @@ do
if (searchString ~= "" and oldText ~= searchString) or next(filterList) then
local list = {}
for i=1, C_AddOns.GetNumAddOns() do
local name, title, notes = C_AddOns.GetAddOnInfo(i)
local name, title = C_AddOns.GetAddOnInfo(i)
if (searchString == "" or (strfind(name:lower(), searchString, nil, true) or (title and strfind(title:lower(), searchString, nil, true)))) and checkFilters(i) then
list[#list + 1] = i
end
Expand Down
14 changes: 3 additions & 11 deletions BetterAddonList_Classic.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
-- luacheck: globals BetterAddonListDB SLASH_BETTERADDONLIST1 SLASH_BETTERADDONLIST2 SLASH_BETTERADDONLIST3 SlashCmdList SLASH_RELOADUI1 SLASH_RELOADUI2
-- luacheck: globals StaticPopup_Show UIDropDownMenu_Initialize UIDropDownMenu_CreateInfo UIDropDownMenu_AddButton UIDropDownMenu_SetSelectedValue UIDROPDOWNMENU_MENU_VALUE
-- luacheck: globals FauxScrollFrame_Update SearchBoxTemplate_OnTextChanged IsAddonVersionCheckEnabled ResetAddOns AddonTooltip_BuildDeps
-- luacheck: globals AddonList AddonCharacterDropDown AddonCharacterDropDownButton AddonListForceLoad AddonListScrollFrame AddonList_Enable
-- luacheck: globals AddonList_SetSecurityIcon AddonList_SetStatus AddonList_Update AddonTooltip_Update ADDON_BUTTON_HEIGHT MAX_ADDONS_DISPLAYED SOUNDKIT

local ADDON_NAME, ns = ...
BetterAddonListDB = BetterAddonListDB or {}

local _G = _G
local tconcat = table.concat

local AddonList_Update = AddonList_Update
local ADDON_BUTTON_HEIGHT = ADDON_BUTTON_HEIGHT
Expand Down Expand Up @@ -156,7 +149,6 @@ function addon:PLAYER_LOGIN()
local regions = {AddonListForceLoad:GetRegions()}
regions[1]:SetPoint("LEFT", AddonListForceLoad, "RIGHT", 2, 0)
regions[1]:SetText(L["Load out of date"])
regions = nil

-- let the frame overlap over ui frames
--UIPanelWindows["AddonList"].area = nil
Expand Down Expand Up @@ -654,7 +646,7 @@ do

local memory = owner.memory
if memory then
local text = ""
local text
if memory > 1000 then
memory = memory / 1000
text = L["Memory: %.02f MB"]:format(memory)
Expand All @@ -679,7 +671,7 @@ do
entry:Hide()
else
-- aaaaand copy from AddonList_Update
local name, title, notes, loadable, reason, security = C_AddOns.GetAddOnInfo(addonIndex)
local name, title, _, loadable, reason, security = C_AddOns.GetAddOnInfo(addonIndex)
local enabled = C_AddOns.GetAddOnEnableState(addonIndex, character) > 0

local checkbox = _G["AddonListEntry"..i.."Enabled"]
Expand Down Expand Up @@ -830,7 +822,7 @@ do
elseif oldText ~= searchString or next(filterList) then
wipe(searchList)
for i=1, C_AddOns.GetNumAddOns() do
local name, title, notes = C_AddOns.GetAddOnInfo(i)
local name, title = C_AddOns.GetAddOnInfo(i)
if (searchString == "" or (strfind(name:lower(), searchString, nil, true) or (title and strfind(title:lower(), searchString, nil, true)))) and checkFilters(i) then
searchList[#searchList+1] = i
end
Expand Down

0 comments on commit 5acf7ca

Please sign in to comment.