Skip to content

Commit 4c5f99a

Browse files
committed
Fix or mask static code warnings from luaLS
1 parent fcc9086 commit 4c5f99a

34 files changed

Lines changed: 110 additions & 89 deletions

spec/System/TestTradeQueryRequests_spec.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ describe("TradeQueryRequests", function()
7070
it("retries on 429 with exponential backoff", function()
7171
local orig_os_time = os.time
7272
local mock_time = 1000
73+
---@diagnostic disable-next-line: duplicate-set-field
7374
os.time = function() return mock_time end
7475

7576
local request = {
@@ -192,4 +193,4 @@ describe("TradeQueryRequests", function()
192193
requests.FetchResultBlock = orig_fetchBlock
193194
end)
194195
end)
195-
end)
196+
end)

src/Classes/CalcsTab.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Effective DPS: Curses and enemy properties (such as resistances and status condi
192192
self.powerBuilderInitialized = nil
193193
end)
194194

195-
function CalcsTabClass:Load(xml, dbFileName)
195+
function CalcsTabClass:Load(xml, fileName)
196196
for _, node in ipairs(xml) do
197197
if type(node) == "table" then
198198
if node.elem == "Input" then
@@ -631,7 +631,7 @@ function CalcsTabClass:PowerBuilder()
631631

632632
-- Calculate the impact of every cluster notable
633633
-- used for the power report screen
634-
for nodeName, node in pairs(self.build.spec.tree.clusterNodeMap) do
634+
for nodeId, node in pairs(self.build.spec.tree.clusterNodeMap) do
635635
if not node.power then
636636
node.power = {}
637637
end

src/Classes/ControlHost.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function ControlHostClass:ProcessControlsInput(inputEvents, viewPort)
6060
inputEvents[id] = nil
6161
end
6262

63-
local mOverControl = self:GetMouseOverControl(viewPort)
63+
local mOverControl = self:GetMouseOverControl()
6464

6565
-- Avoid calculating isMouseInRegion as much as possible as it's expensive
6666
if mOverControl and (not selControl or mOverControl.OnHoverKeyUp) then

src/Classes/EditControl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function EditClass:Draw(viewPort, noTooltip)
297297
else
298298
SetDrawColor(self.inactiveCol)
299299
if self.inactiveText then
300-
local inactiveText = type(inactiveText) == "string" and self.inactiveText or self.inactiveText(self.buf)
300+
local inactiveText = type(self.inactiveText) == "string" and self.inactiveText or self.inactiveText(self.buf)
301301
DrawString(-self.controls.scrollBarH.offset, -self.controls.scrollBarV.offset, "LEFT", textHeight, self.font, inactiveText)
302302
elseif self.protected then
303303
DrawString(-self.controls.scrollBarH.offset, -self.controls.scrollBarV.offset, "LEFT", textHeight, self.font, string.rep(protected_replace, #self.buf))

src/Classes/GemSelectControl.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ function GemSelectClass:UpdateSortCache()
309309
sortCache.dps[gemId] = baseDPS
310310
-- Ignore gems that don't support the active skill
311311
if sortCache.canSupport[gemId] or (gemData.grantedEffect.hasGlobalEffect and not gemData.grantedEffect.support) then
312-
local output = self:CalcOutputWithThisGem(calcFunc, gemData, useFullDPS, fastCalcOptions, calcBase)
312+
local output = self:CalcOutputWithThisGem(calcFunc, gemData, useFullDPS)
313313
-- Check for nil because some fields may not be populated, default to 0
314314
sortCache.dps[gemId] = (dpsField == "FullDPS" and output[dpsField] ~= nil and output[dpsField]) or (output.Minion and output.Minion.CombinedDPS) or (output[dpsField] ~= nil and output[dpsField]) or 0
315315
end
@@ -452,7 +452,7 @@ function GemSelectClass:Draw(viewPort, noTooltip)
452452
if calcFunc then
453453
self.tooltip:Clear()
454454
local gemData = self.gems[self.list[self.hoverSel]]
455-
local output = self:CalcOutputWithThisGem(calcFunc, gemData, self.skillsTab.sortGemsByDPSField == "FullDPS", nil, calcBase)
455+
local output = self:CalcOutputWithThisGem(calcFunc, gemData, self.skillsTab.sortGemsByDPSField == "FullDPS")
456456
local gemInstance = {
457457
level = self.skillsTab:ProcessGemLevel(gemData),
458458
quality = self.skillsTab.defaultGemQuality or 0,
@@ -911,4 +911,4 @@ function GemSelectClass:OnKeyUp(key)
911911
end
912912
local newSel = self.EditControl:OnKeyUp(key)
913913
return newSel == self.EditControl and self or newSel
914-
end
914+
end

src/Classes/ModDB.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function ModDBClass:ListInternal(context, result, cfg, flags, keywordFlags, sour
209209
if mod.type == "LIST" and band(flags, mod.flags) == mod.flags and MatchKeywordFlags(keywordFlags, mod.keywordFlags) and (not source or mod.source:match("[^:]+") == source) then
210210
local value
211211
if mod[1] then
212-
local value = context:EvalMod(mod, cfg) or nullValue
212+
local value = context:EvalMod(mod, cfg) or nil
213213
if value then
214214
t_insert(result, value)
215215
end
@@ -315,4 +315,4 @@ function ModDBClass:Print()
315315
for i, name in ipairs(nameList) do
316316
ConPrintf("%s = %d", name, self.multipliers[name])
317317
end
318-
end
318+
end

src/Classes/ModList.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function ModListClass:ListInternal(context, result, cfg, flags, keywordFlags, so
179179
if mod.name == modName and mod.type == "LIST" and band(flags, mod.flags) == mod.flags and MatchKeywordFlags(keywordFlags, mod.keywordFlags) and (not source or mod.source:match("[^:]+") == source) then
180180
local value
181181
if mod[1] then
182-
local value = context:EvalMod(mod, cfg) or nullValue
182+
local value = context:EvalMod(mod, cfg) or nil
183183
if value then
184184
t_insert(result, value)
185185
end

src/Classes/ModStore.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ function ModStoreClass:GetStat(stat, cfg)
278278
local totalLife = self.actor.output["Life"]
279279
if totalLife == 0 then return 0 else
280280
for _, activeSkill in ipairs(self.actor.activeSkillList) do
281+
---@diagnostic disable-next-line: undefined-global
281282
if (activeSkill.skillTypes[SkillType.HasReservation] and not activeSkill.skillFlags.disable and activeSkill.buffList and activeSkill.buffList[1] and cfg and (isNameInBuffList(activeSkill.buffList, cfg.skillName) or isNameInBuffList(activeSkill.buffList, cfg.summonSkillName)) ) then
282283
local lifeBase = activeSkill.skillData["LifeReservedBase"] or 0
283284
reservedPercentLife = lifeBase / totalLife * 100
@@ -863,4 +864,4 @@ function ModStoreClass:EvalMod(mod, cfg, globalLimits)
863864
end
864865
end
865866
return value
866-
end
867+
end

src/Classes/PartyTab.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,11 @@ local PartyTabClass = newClass("PartyTab", "ControlHost", "Control", function(se
191191
-- Parse the XML
192192
local dbXML, errMsg = common.xml.ParseXML(self.importCodeXML)
193193
if not dbXML then
194+
---@diagnostic disable-next-line: undefined-global
194195
launch:ShowErrMsg("^1Error loading '%s': %s", fileName, errMsg)
195196
return
196197
elseif dbXML[1].elem ~= "PathOfBuilding2" then
198+
---@diagnostic disable-next-line: undefined-global
197199
launch:ShowErrMsg("^1Error parsing '%s': 'PathOfBuilding2' root element missing", fileName)
198200
return
199201
end
@@ -908,6 +910,7 @@ function PartyTabClass:ParseBuffs(list, buf, buffType, label)
908910
end
909911
end
910912
if list["AuraDebuff"] and list["AuraDebuff"]["Vaal"] then
913+
---@diagnostic disable-next-line: undefined-global
911914
if not list["Aura"] or not list["Aura"]["Vaal"] or not list["Aura"]["Vaal"][aura] then
912915
for aura, auraMod in pairs(list["AuraDebuff"]["Vaal"]) do
913916
t_insert(labelList, aura..": "..auraMod.effectMult.."%\n")
@@ -1032,4 +1035,4 @@ function PartyTabClass:exportBuffs(buffType)
10321035
self.buffExports[buffType] = { ConvertedToText = true }
10331036
self.buffExports[buffType].string = buf
10341037
return buf
1035-
end
1038+
end

src/Classes/PassiveSpec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2255,7 +2255,7 @@ end
22552255
--- Adds a line to or replaces a node given a line to add/replace with
22562256
--- @param node table The node to replace/add to
22572257
--- @param sd string The line being parsed and added
2258-
--- @param replacement boolean true to replace the node with the new mod, false to simply add it
2258+
--- @param replacement boolean? true to replace the node with the new mod, false to simply add it
22592259
function PassiveSpecClass:NodeAdditionOrReplacementFromString(node,sd,replacement)
22602260
local addition = {}
22612261
addition.sd = {sd}

0 commit comments

Comments
 (0)