Skip to content

Commit

Permalink
docs: fix some annotation warnings (#4116)
Browse files Browse the repository at this point in the history
* move to correct folder

* fix some annos

* fix annos of RL player ext

* as per review
  • Loading branch information
hjpalpha authored Mar 26, 2024
1 parent 02a0939 commit 2280863
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/match2/commons/bracket_template.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ end
---@return Html
function BracketTemplate.BracketContainer(props)
return BracketDisplay.Bracket({
bracket = MatchGroupUtil.fetchMatchGroup(props.bracketId),
bracket = MatchGroupUtil.fetchMatchGroup(props.bracketId) --[[@as MatchGroupUtilBracket]],
config = Table.merge(props.config, {
OpponentEntry = function() return mw.html.create('div'):addClass('brkts-opponent-entry') end,
matchHasDetails = function() return false end,
Expand Down
1 change: 1 addition & 0 deletions components/match2/commons/brkts_wiki_specific_base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local FnUtil = require('Module:FnUtil')
local Lua = require('Module:Lua')

---@class BrktsWikiSpecific
---@field defaultIcon string?
local WikiSpecificBase = {}

-- called from Module:MatchGroup
Expand Down
2 changes: 1 addition & 1 deletion components/match2/commons/match_group.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function MatchGroup.Bracket(args)

local parts = Array.extend(
Array.map(optionsWarnings, WarningBox.display),
Array.map(bracketWarnings, WarningBox.display),
Array.map(bracketWarnings or {}, WarningBox.display),
{bracketNode}
)
return table.concat(Array.map(parts, tostring))
Expand Down
4 changes: 4 additions & 0 deletions components/match2/test/match_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ function suite:testSplitRecordsByType()
MatchTestConfig.EXPECTED_OUTPUT_AFTER_SPLIT, Match.splitRecordsByType(MatchTestConfig.EXAMPLE_MATCH))
self:assertDeepEquals(
MatchTestConfig.EXPECTED_OUTPUT_AFTER_SPLIT_SC2, Match.splitRecordsByType(MatchTestConfig.EXAMPLE_MATCH_SC2))
---intended missmatch
---@diagnostic disable-next-line: param-type-mismatch
self:assertDeepEquals({}, Match.splitRecordsByType(nil))
---intended missmatch
---@diagnostic disable-next-line: param-type-mismatch
self:assertDeepEquals({}, Match.splitRecordsByType('something'))
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function CustomMatchGroupInput._mapInput(match, mapIndex)
-- Init score if match started and map info is present
if not match.opponent1.autoscore and not match.opponent2.autoscore
and map.map and map.map ~= 'TBD'
and match.timestamp < os.time(os.date('!*t'))
and match.timestamp < os.time(os.date('!*t') --[[@as osdateparam]])
and String.isNotEmpty(map.civs1) and String.isNotEmpty(map.civs2) then
match.opponent1.autoscore = 0
match.opponent2.autoscore = 0
Expand Down
1 change: 1 addition & 0 deletions components/match2/wikis/ageofempires/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ end

---@param winner integer|string
---@param opponentIndex integer
---@param soloMode boolean
---@return Html
function CustomMatchSummary._createCheckMark(winner, opponentIndex, soloMode)
return mw.html.create('div')
Expand Down
6 changes: 4 additions & 2 deletions components/match2/wikis/apexlegends/brkts_wikispecific.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
local Lua = require('Module:Lua')
local Table = require('Module:Table')

local WikiSpecific = Table.copy(Lua.import('Module:Brkts/WikiSpecific/Base'))
local BaseWikiSpecific = Lua.import('Module:Brkts/WikiSpecific/Base')

---@class ApexlegendsBrktsWikiSpecific: BrktsWikiSpecific
local WikiSpecific = Table.copy(BaseWikiSpecific)

---@diagnostic disable-next-line: duplicate-set-field
function WikiSpecific.getMatchGroupContainer(matchGroupType)
return Lua.import('Module:MatchGroup/Display/Horizontallist').BracketContainer
end
Expand Down
1 change: 1 addition & 0 deletions components/match2/wikis/arenafps/match_legacy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ end
---@param match2 table
---@return table
function MatchLegacy._convertParameters(match2)
---@type table
local match = Table.filterByKey(match2, function(key) return not String.startsWith(key, 'match2') end)

match.staticid = match2.match2id
Expand Down
5 changes: 4 additions & 1 deletion components/match2/wikis/rocketleague/brkts_wiki_specific.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
local Lua = require('Module:Lua')
local Table = require('Module:Table')

local WikiSpecific = Table.copy(Lua.import('Module:Brkts/WikiSpecific/Base'))
local BaseWikiSpecific = Lua.import('Module:Brkts/WikiSpecific/Base')

---@class RocketleagueBrktsWikiSpecific: BrktsWikiSpecific
local WikiSpecific = Table.copy(BaseWikiSpecific)

function WikiSpecific.getMatchGroupContainer(matchGroupType)
return matchGroupType == 'matchlist'
Expand Down
2 changes: 1 addition & 1 deletion components/match2/wikis/trackmania/match_summary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function CustomMatchSummary._createGame(game)
return row
end

---@param icon string
---@param icon string?
---@param shouldDisplay boolean?
---@param additionalElement number|string|Html|nil
---@param side integer?
Expand Down
2 changes: 1 addition & 1 deletion components/match2/wikis/warcraft/match_legacy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function MatchLegacy._convertParameters(match2)
local match = Table.filterByKey(match2, function(key, entry) return not String.startsWith(key, 'match2') end)
---@cast match table
match.type = match.type and string.lower(match.type) or nil
match.header = DisplayHelper.expandHeader(Logic.emptyOr(bracketData.header, bracketData.inheritedheader, ''))[1]
match.header = DisplayHelper.expandHeader(Logic.emptyOr(bracketData.header, bracketData.inheritedheader) or '')[1]
match.tickername = Variables.varDefault('tournament_tickername', Variables.varDefault('tournament_ticker_name'))

match.staticid = match2.match2id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@

local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
local Table = require('Module:Table')

local PlayerExt = Lua.import('Module:Player/Ext')

---@class RocketleaguePlayerExt: PlayerExt
local PlayerExtCustom = Table.copy(PlayerExt)

--- Asks LPDB for the team a player belonged to on a page. For specific uses only.
---@param resolvedPageName string
---@date resolvedPageName string
function PlayerExt.fetchTeamHistoryEntry(resolvedPageName, date)
---@param date string|number|osdate?
---@return {joinDate: string|number|osdate?, leaveDate: string|number|osdate?, template: string}?
function PlayerExtCustom.fetchTeamHistoryEntry(resolvedPageName, date)
if Logic.isEmpty(resolvedPageName) then
return
end
Expand All @@ -37,4 +42,4 @@ function PlayerExt.fetchTeamHistoryEntry(resolvedPageName, date)
end
end

return PlayerExt
return PlayerExtCustom

0 comments on commit 2280863

Please sign in to comment.