-- luacheck configuration for Portal Pro
--
-- The WoW client injects its entire API as globals, so without this every API call reads
-- as an undefined global and the signal drowns in noise. Only APIs this addon actually
-- touches are listed — an unlisted call showing up as a warning is a useful prompt to
-- check whether it exists on Classic Era at all.

std = "lua51"
max_line_length = 110
codes = true

exclude_files = {
	".github/",
	"tools/",
}

-- Globals the addon itself defines.
globals = {
	"PortalProDB",
	"PortalPro_Binding_Broadcast",
	"PortalPro_Binding_Toggle",
	"PortalPro_Binding_AcceptLead",
	"BINDING_HEADER_PORTALPRO",
	"BINDING_NAME_PORTALPRO_BROADCAST",
	"BINDING_NAME_PORTALPRO_TOGGLE",
	"BINDING_NAME_PORTALPRO_ACCEPT_LEAD",
	"SLASH_PORTALPRO1",
	"SLASH_PORTALPRO2",
	"SlashCmdList",
	"UISpecialFrames",
}

-- Read-only client API.
read_globals = {
	-- Namespaces
	"C_AddOns", "C_ChatInfo", "C_Container", "C_Item", "C_PartyInfo", "C_Spell", "C_Timer",

	-- Frames & UI
	"CreateFrame", "UIParent", "Minimap", "GameTooltip", "CreateColor",
	"STANDARD_TEXT_FONT", "RAID_CLASS_COLORS", "SOUNDKIT",
	"ChatEdit_GetActiveWindow", "TradeFrameRecipientNameText",

	-- Player & world
	"UnitName", "UnitClass", "UnitFactionGroup", "UnitInParty", "UnitInRaid",
	"UnitIsGroupLeader", "UnitIsGroupAssistant",
	"GetRealmName", "GetZoneText", "GetRealZoneText", "GetPlayerInfoByGUID",

	-- Chat
	"SendChatMessage", "JoinChannelByName", "GetChannelName", "GetChannelList", "Ambiguate",

	-- Group
	"GetNumGroupMembers", "IsInGroup", "IsInRaid", "InviteUnit", "UninviteUnit", "LeaveParty",

	-- Money, trade, mail
	"GetMoney", "GetTargetTradeMoney", "GetPlayerTradeMoney",
	"GetInboxHeaderInfo", "GetInboxText", "TakeInboxMoney", "SendMail", "GetSendMailMoney",

	-- Spells & items
	"GetSpellInfo", "GetSpellTexture", "IsSpellKnown",
	"GetItemCount", "GetItemInfo", "GetItemIcon",

	-- Misc
	"GetTime", "PlaySound", "PlaySoundFile", "FlashClientIcon",
	"IsMouseButtonDown", "GetCursorPosition", "hooksecurefunc",
	"wipe", "strjoin", "tostringall", "tinsert", "tremove", "date", "time",
}

ignore = {
	"212", -- unused argument: event handlers legitimately ignore leading args
	"542", -- empty if branch
}
