From 7c5863e6791be86bc4eea83ea0cbcc25d8beba66 Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Mon, 15 Jan 2024 11:06:00 +0100 Subject: [PATCH] refactor: remove remaining unneeded `requireDevIfEnabled=true` (#3778) * refactor: remove unneeded `requireDevIfEnabled=true` * refactor: remove unneeded `requireDevIfEnabled=true` * update comment --------- Co-authored-by: hjpalpha <75081997+hjpalpha@users.noreply.github.com> --- components/infobox/commons/infobox_widget_links.lua | 2 +- .../wikis/ageofempires/infobox_person_player_custom.lua | 6 +++--- .../wikis/counterstrike/infobox_person_player_custom.lua | 6 +++--- .../infobox/wikis/dota2/infobox_person_player_custom.lua | 6 +++--- components/infobox/wikis/esports/infobox_game_custom.lua | 4 ++-- .../wikis/rainbowsix/infobox_person_player_custom.lua | 6 +++--- .../wikis/rocketleague/infobox_person_player_custom.lua | 6 +++--- .../wikis/starcraft2/infobox_person_player_custom.lua | 8 ++++---- components/infobox/wikis/stormgate/infobox_map_custom.lua | 4 ++-- .../wikis/stormgate/infobox_person_player_custom.lua | 6 +++--- .../wikis/warcraft/infobox_person_player_custom.lua | 6 +++--- components/match2/commons/get_match_group_copy_paste.lua | 2 +- components/match2/commons/match_group.lua | 2 +- .../starcraft_starcraft2/match_group_input_starcraft.lua | 2 +- .../wikis/leagueoflegends/legacy/match_maps_legacy.lua | 2 +- components/match2/wikis/starcraft/brkts_wiki_specific.lua | 5 +---- .../match2/wikis/starcraft2/brkts_wiki_specific.lua | 5 +---- components/match2/wikis/stormgate/brkts_wiki_specific.lua | 5 +---- standard/links/commons/links.lua | 2 +- standard/lua.lua | 8 ++++---- standard/mock/mock_lpdb.lua | 2 +- standard/region/commons/region.lua | 3 +-- standard/test/json_test.lua | 2 +- 23 files changed, 45 insertions(+), 55 deletions(-) diff --git a/components/infobox/commons/infobox_widget_links.lua b/components/infobox/commons/infobox_widget_links.lua index 39a8fe48de2..088c3d7e0ad 100644 --- a/components/infobox/commons/infobox_widget_links.lua +++ b/components/infobox/commons/infobox_widget_links.lua @@ -25,7 +25,7 @@ local Links = Class.new( end ) -local PRIORITY_GROUPS = Lua.import('Module:Links/PriorityGroups', {requireDevIfEnabled = true, loadData = true}) +local PRIORITY_GROUPS = Lua.import('Module:Links/PriorityGroups', {loadData = true}) ---@return {[1]: Html} function Links:make() diff --git a/components/infobox/wikis/ageofempires/infobox_person_player_custom.lua b/components/infobox/wikis/ageofempires/infobox_person_player_custom.lua index c214852b062..6ae95de0093 100644 --- a/components/infobox/wikis/ageofempires/infobox_person_player_custom.lua +++ b/components/infobox/wikis/ageofempires/infobox_person_player_custom.lua @@ -22,9 +22,9 @@ local String = require('Module:StringUtils') local Table = require('Module:Table') local TeamHistoryAuto = require('Module:TeamHistoryAuto') -local Achievements = Lua.import('Module:Infobox/Extension/Achievements', {requireDevIfEnabled = true}) -local Injector = Lua.import('Module:Infobox/Widget/Injector', {requireDevIfEnabled = true}) -local Player = Lua.import('Module:Infobox/Person', {requireDevIfEnabled = true}) +local Achievements = Lua.import('Module:Infobox/Extension/Achievements') +local Injector = Lua.import('Module:Infobox/Widget/Injector') +local Player = Lua.import('Module:Infobox/Person') local Widgets = require('Module:Infobox/Widget/All') local Cell = Widgets.Cell diff --git a/components/infobox/wikis/counterstrike/infobox_person_player_custom.lua b/components/infobox/wikis/counterstrike/infobox_person_player_custom.lua index 0568acf04e5..b1b1f6f53a3 100644 --- a/components/infobox/wikis/counterstrike/infobox_person_player_custom.lua +++ b/components/infobox/wikis/counterstrike/infobox_person_player_custom.lua @@ -15,9 +15,9 @@ local String = require('Module:StringUtils') local Table = require('Module:Table') local Variables = require('Module:Variables') -local Game = Lua.import('Module:Game', {requireDevIfEnabled = true}) -local Injector = Lua.import('Module:Infobox/Widget/Injector', {requireDevIfEnabled = true}) -local Player = Lua.import('Module:Infobox/Person', {requireDevIfEnabled = true}) +local Game = Lua.import('Module:Game') +local Injector = Lua.import('Module:Infobox/Widget/Injector') +local Player = Lua.import('Module:Infobox/Person') local Widgets = require('Module:Infobox/Widget/All') local Cell = Widgets.Cell diff --git a/components/infobox/wikis/dota2/infobox_person_player_custom.lua b/components/infobox/wikis/dota2/infobox_person_player_custom.lua index 5938249266a..782186f03b0 100644 --- a/components/infobox/wikis/dota2/infobox_person_player_custom.lua +++ b/components/infobox/wikis/dota2/infobox_person_player_custom.lua @@ -18,9 +18,9 @@ local Template = require('Module:Template') local Variables = require('Module:Variables') local YearsActive = require('Module:YearsActive') -local Flags = Lua.import('Module:Flags', {requireDevIfEnabled = true}) -local Injector = Lua.import('Module:Infobox/Widget/Injector', {requireDevIfEnabled = true}) -local Player = Lua.import('Module:Infobox/Person', {requireDevIfEnabled = true}) +local Flags = Lua.import('Module:Flags') +local Injector = Lua.import('Module:Infobox/Widget/Injector') +local Player = Lua.import('Module:Infobox/Person') local Widgets = require('Module:Infobox/Widget/All') local Cell = Widgets.Cell diff --git a/components/infobox/wikis/esports/infobox_game_custom.lua b/components/infobox/wikis/esports/infobox_game_custom.lua index 16b78d2e760..41cf5f2a658 100644 --- a/components/infobox/wikis/esports/infobox_game_custom.lua +++ b/components/infobox/wikis/esports/infobox_game_custom.lua @@ -11,9 +11,9 @@ local Array = require('Module:Array') local Class = require('Module:Class') local Lua = require('Module:Lua') -local Game = Lua.import('Module:Infobox/Game', {requireDevIfEnabled = true}) +local Game = Lua.import('Module:Infobox/Game') -local Injector = Lua.import('Module:Infobox/Widget/Injector', {requireDevIfEnabled = true}) +local Injector = Lua.import('Module:Infobox/Widget/Injector') local Widgets = require('Module:Infobox/Widget/All') local Cell = Widgets.Cell diff --git a/components/infobox/wikis/rainbowsix/infobox_person_player_custom.lua b/components/infobox/wikis/rainbowsix/infobox_person_player_custom.lua index 2a0955c56c2..59472c34136 100644 --- a/components/infobox/wikis/rainbowsix/infobox_person_player_custom.lua +++ b/components/infobox/wikis/rainbowsix/infobox_person_player_custom.lua @@ -18,10 +18,10 @@ local TeamHistoryAuto = require('Module:TeamHistoryAuto') local Variables = require('Module:Variables') local Template = require('Module:Template') -local Injector = Lua.import('Module:Infobox/Widget/Injector', {requireDevIfEnabled = true}) -local Player = Lua.import('Module:Infobox/Person', {requireDevIfEnabled = true}) +local Injector = Lua.import('Module:Infobox/Widget/Injector') +local Player = Lua.import('Module:Infobox/Person') -local Achievements = Lua.import('Module:Infobox/Extension/Achievements', {requireDevIfEnabled = true}) +local Achievements = Lua.import('Module:Infobox/Extension/Achievements') local ACHIEVEMENTS_BASE_CONDITIONS = { '[[liquipediatiertype::!Showmatch]]', diff --git a/components/infobox/wikis/rocketleague/infobox_person_player_custom.lua b/components/infobox/wikis/rocketleague/infobox_person_player_custom.lua index 66b12cc9712..98f80b72091 100644 --- a/components/infobox/wikis/rocketleague/infobox_person_player_custom.lua +++ b/components/infobox/wikis/rocketleague/infobox_person_player_custom.lua @@ -16,9 +16,9 @@ local Page = require('Module:Page') local String = require('Module:StringUtils') local Variables = require('Module:Variables') -local Injector = Lua.import('Module:Infobox/Widget/Injector', {requireDevIfEnabled = true}) -local Player = Lua.import('Module:Infobox/Person', {requireDevIfEnabled = true}) -local YearsActive = Lua.import('Module:YearsActive', {requireDevIfEnabled = true}) +local Injector = Lua.import('Module:Infobox/Widget/Injector') +local Player = Lua.import('Module:Infobox/Person') +local YearsActive = Lua.import('Module:YearsActive') local Widgets = require('Module:Infobox/Widget/All') local Cell = Widgets.Cell diff --git a/components/infobox/wikis/starcraft2/infobox_person_player_custom.lua b/components/infobox/wikis/starcraft2/infobox_person_player_custom.lua index e582cfe5508..9d114498454 100644 --- a/components/infobox/wikis/starcraft2/infobox_person_player_custom.lua +++ b/components/infobox/wikis/starcraft2/infobox_person_player_custom.lua @@ -21,9 +21,9 @@ local String = require('Module:StringUtils') local Table = require('Module:Table') local Variables = require('Module:Variables') -local Achievements = Lua.import('Module:Infobox/Extension/Achievements', {requireDevIfEnabled = true}) -local CustomPerson = Lua.import('Module:Infobox/Person/Custom', {requireDevIfEnabled = true}) -local Opponent = Lua.import('Module:Opponent/Starcraft', {requireDevIfEnabled = true}) +local Achievements = Lua.import('Module:Infobox/Extension/Achievements') +local CustomPerson = Lua.import('Module:Infobox/Person/Custom') +local Opponent = Lua.import('Module:Opponent/Starcraft') local Condition = require('Module:Condition') local ConditionTree = Condition.Tree @@ -48,7 +48,7 @@ local AVAILABLE_RACES = Array.append(Faction.knownFactions, 'total') local RACE_FIELD_AS_CATEGORY_LINK = true local CURRENT_YEAR = tonumber(os.date('%Y')) -local Injector = Lua.import('Module:Infobox/Widget/Injector', {requireDevIfEnabled = true}) +local Injector = Lua.import('Module:Infobox/Widget/Injector') local Cell = require('Module:Infobox/Widget/Cell') local Title = require('Module:Infobox/Widget/Title') diff --git a/components/infobox/wikis/stormgate/infobox_map_custom.lua b/components/infobox/wikis/stormgate/infobox_map_custom.lua index ef4f171653e..013e9c46e9d 100644 --- a/components/infobox/wikis/stormgate/infobox_map_custom.lua +++ b/components/infobox/wikis/stormgate/infobox_map_custom.lua @@ -14,8 +14,8 @@ local Operator = require('Module:Operator') local String = require('Module:StringUtils') local Table = require('Module:Table') -local Injector = Lua.import('Module:Infobox/Widget/Injector', {requireDevIfEnabled = true}) -local Map = Lua.import('Module:Infobox/Map', {requireDevIfEnabled = true}) +local Injector = Lua.import('Module:Infobox/Widget/Injector') +local Map = Lua.import('Module:Infobox/Map') local Widgets = require('Module:Infobox/Widget/All') local Cell = Widgets.Cell diff --git a/components/infobox/wikis/stormgate/infobox_person_player_custom.lua b/components/infobox/wikis/stormgate/infobox_person_player_custom.lua index 811997ac78d..803c3b482e7 100644 --- a/components/infobox/wikis/stormgate/infobox_person_player_custom.lua +++ b/components/infobox/wikis/stormgate/infobox_person_player_custom.lua @@ -17,9 +17,9 @@ local TeamHistoryAuto = require('Module:TeamHistoryAuto') local Variables = require('Module:Variables') local YearsActive = require('Module:YearsActive') -local Achievements = Lua.import('Module:Infobox/Extension/Achievements', {requireDevIfEnabled = true}) -local MatchTicker = Lua.import('Module:MatchTicker/Custom', {requireDevIfEnabled = true}) -local Person = Lua.import('Module:Infobox/Person', {requireDevIfEnabled = true}) +local Achievements = Lua.import('Module:Infobox/Extension/Achievements') +local MatchTicker = Lua.import('Module:MatchTicker/Custom') +local Person = Lua.import('Module:Infobox/Person') local CURRENT_YEAR = tonumber(os.date('%Y')) diff --git a/components/infobox/wikis/warcraft/infobox_person_player_custom.lua b/components/infobox/wikis/warcraft/infobox_person_player_custom.lua index cd19401bbba..361f387adc1 100644 --- a/components/infobox/wikis/warcraft/infobox_person_player_custom.lua +++ b/components/infobox/wikis/warcraft/infobox_person_player_custom.lua @@ -12,9 +12,9 @@ local Lua = require('Module:Lua') local Math = require('Module:MathUtil') local Variables = require('Module:Variables') -local Achievements = Lua.import('Module:Infobox/Extension/Achievements', {requireDevIfEnabled = true}) -local Injector = Lua.import('Module:Infobox/Widget/Injector', {requireDevIfEnabled = true}) -local Player = Lua.import('Module:Infobox/Person', {requireDevIfEnabled = true}) +local Achievements = Lua.import('Module:Infobox/Extension/Achievements') +local Injector = Lua.import('Module:Infobox/Widget/Injector') +local Player = Lua.import('Module:Infobox/Person') local Widgets = require('Module:Infobox/Widget/All') local Cell = Widgets.Cell diff --git a/components/match2/commons/get_match_group_copy_paste.lua b/components/match2/commons/get_match_group_copy_paste.lua index 065b935c545..b6407c6a58f 100644 --- a/components/match2/commons/get_match_group_copy_paste.lua +++ b/components/match2/commons/get_match_group_copy_paste.lua @@ -19,7 +19,7 @@ local WikiSpecific = Lua.import('Module:GetMatchGroupCopyPaste/wiki') local getArgs = require('Module:Arguments').getArgs local MatchGroupUtil = Lua.import('Module:MatchGroup/Util') -local BracketAlias = Lua.requireIfExists('Module:BracketAlias', {requireDevIfEnabled = true, loadData = true}) +local BracketAlias = Lua.requireIfExists('Module:BracketAlias', {loadData = true}) local copyPaste = {} diff --git a/components/match2/commons/match_group.lua b/components/match2/commons/match_group.lua index 03168917812..c0bf990b739 100644 --- a/components/match2/commons/match_group.lua +++ b/components/match2/commons/match_group.lua @@ -17,7 +17,7 @@ local WarningBox = require('Module:WarningBox') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local Match = Lua.import('Module:Match') local MatchGroupBase = Lua.import('Module:MatchGroup/Base') -local MatchGroupConfig = Lua.requireIfExists('Module:MatchGroup/Config', {requireDevIfEnabled = true, loadData = true}) +local MatchGroupConfig = Lua.requireIfExists('Module:MatchGroup/Config', {loadData = true}) local MatchGroupInput = Lua.import('Module:MatchGroup/Input') local MatchGroupUtil = Lua.import('Module:MatchGroup/Util') local ShortenBracket = Lua.import('Module:MatchGroup/ShortenBracket') diff --git a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua index 8489d52dce1..f2230c22aef 100644 --- a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua +++ b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua @@ -18,7 +18,7 @@ local Table = require('Module:Table') local TeamTemplate = require('Module:TeamTemplate/Named') local Variables = require('Module:Variables') -local config = Lua.requireIfExists('Module:Match/Config', {requireDevIfEnabled = true, loadData = true}) or {} +local config = Lua.requireIfExists('Module:Match/Config', {loadData = true}) or {} local MatchGroupInput = Lua.import('Module:MatchGroup/Input') local Opponent = Lua.import('Module:Opponent') local Streams = Lua.import('Module:Links/Stream') diff --git a/components/match2/wikis/leagueoflegends/legacy/match_maps_legacy.lua b/components/match2/wikis/leagueoflegends/legacy/match_maps_legacy.lua index b59f81465ed..4181fc2080c 100644 --- a/components/match2/wikis/leagueoflegends/legacy/match_maps_legacy.lua +++ b/components/match2/wikis/leagueoflegends/legacy/match_maps_legacy.lua @@ -18,7 +18,7 @@ local PageVariableNamespace = require('Module:PageVariableNamespace') local Table = require('Module:Table') local Template = require('Module:Template') -local MatchSubobjects = Lua.import('Module:Match/Subobjects', { requireDevIfEnabled = true }) +local MatchSubobjects = Lua.import('Module:Match/Subobjects') local globalVars = PageVariableNamespace() local matchlistVars = PageVariableNamespace('LegacyMatchlist') diff --git a/components/match2/wikis/starcraft/brkts_wiki_specific.lua b/components/match2/wikis/starcraft/brkts_wiki_specific.lua index 432f712c46b..daea42e93d4 100644 --- a/components/match2/wikis/starcraft/brkts_wiki_specific.lua +++ b/components/match2/wikis/starcraft/brkts_wiki_specific.lua @@ -52,10 +52,7 @@ end function WikiSpecific.getMatchContainer(displayMode) if displayMode == 'singleMatch' then -- Single match, displayed flat on a page (no popup) - local SingleMatch = Lua.import( - 'Module:MatchGroup/Display/SingleMatch/Starcraft', - {requireDevIfEnabled = true} - ) + local SingleMatch = Lua.import('Module:MatchGroup/Display/SingleMatch/Starcraft') return SingleMatch.SingleMatchContainer end end diff --git a/components/match2/wikis/starcraft2/brkts_wiki_specific.lua b/components/match2/wikis/starcraft2/brkts_wiki_specific.lua index 15495f60df4..11d1320d08d 100644 --- a/components/match2/wikis/starcraft2/brkts_wiki_specific.lua +++ b/components/match2/wikis/starcraft2/brkts_wiki_specific.lua @@ -52,10 +52,7 @@ end function WikiSpecific.getMatchContainer(displayMode) if displayMode == 'singleMatch' then -- Single match, displayed flat on a page (no popup) - local SingleMatch = Lua.import( - 'Module:MatchGroup/Display/SingleMatch/Starcraft', - {requireDevIfEnabled = true} - ) + local SingleMatch = Lua.import('Module:MatchGroup/Display/SingleMatch/Starcraft') return SingleMatch.SingleMatchContainer end end diff --git a/components/match2/wikis/stormgate/brkts_wiki_specific.lua b/components/match2/wikis/stormgate/brkts_wiki_specific.lua index 95378b8986c..f5139354890 100644 --- a/components/match2/wikis/stormgate/brkts_wiki_specific.lua +++ b/components/match2/wikis/stormgate/brkts_wiki_specific.lua @@ -52,10 +52,7 @@ end function WikiSpecific.getMatchContainer(displayMode) if displayMode == 'singleMatch' then -- Single match, displayed flat on a page (no popup) - local SingleMatch = Lua.import( - 'Module:MatchGroup/Display/SingleMatch/Starcraft', - {requireDevIfEnabled = true} - ) + local SingleMatch = Lua.import('Module:MatchGroup/Display/SingleMatch/Starcraft') return SingleMatch.SingleMatchContainer end end diff --git a/standard/links/commons/links.lua b/standard/links/commons/links.lua index 41458b95b7f..0fa889d6ed4 100644 --- a/standard/links/commons/links.lua +++ b/standard/links/commons/links.lua @@ -11,7 +11,7 @@ local Class = require('Module:Class') local Lua = require('Module:Lua') local Table = require('Module:Table') -local CustomData = Lua.requireIfExists('Module:Links/CustomData', {requireDevIfEnabled = true, loadData = true}) or {} +local CustomData = Lua.requireIfExists('Module:Links/CustomData', {loadData = true}) or {} local Links = {} diff --git a/standard/lua.lua b/standard/lua.lua index cf9e6d300d2..1fa82da6728 100644 --- a/standard/lua.lua +++ b/standard/lua.lua @@ -35,8 +35,8 @@ end ---Imports a module if it exists by its name. --- ----Allows requireDevIfEnabled option (requires the development version of a module if it ----exists and the dev feature flag is enabled. Otherwise requires the non-development module). +---By default it will include the /dev module if in dev mode activated. This can be turned off by setting +--- the requireDevIfEnabled option to false. ---@param name string ---@param options {requireDevIfEnabled: boolean, loadData: boolean?}? ---@return unknown? @@ -137,7 +137,7 @@ function Lua.invoke(frame) local flags = {dev = devEnabled(frame)} return require('Module:FeatureFlag').with(flags, function() - local module = Lua.import('Module:' .. moduleName, {requireDevIfEnabled = true}) + local module = Lua.import('Module:' .. moduleName) return module[fnName](frame) end) end @@ -178,7 +178,7 @@ function Lua.wrapAutoInvoke(module, baseModuleName, fnName) local flags = {dev = Logic.readBoolOrNil(dev)} return require('Module:FeatureFlag').with(flags, function() - local variantModule = Lua.import(baseModuleName, {requireDevIfEnabled = true}) + local variantModule = Lua.import(baseModuleName) local fn = module == variantModule and moduleFn or variantModule[fnName] return fn(frame) end) diff --git a/standard/mock/mock_lpdb.lua b/standard/mock/mock_lpdb.lua index d90263913e2..8fe0b9c4473 100644 --- a/standard/mock/mock_lpdb.lua +++ b/standard/mock/mock_lpdb.lua @@ -149,7 +149,7 @@ end ---@param dbTable string ---@return table function mockLpdb._getMockData(dbTable) - local data = Lua.import('Module:TestAssets/Lpdb/' .. dbTable, {requireDevIfEnabled = true}) + local data = Lua.import('Module:TestAssets/Lpdb/' .. dbTable) if not data then error(mw.message.new('liquipediadb-error-invalid-datatype')) diff --git a/standard/region/commons/region.lua b/standard/region/commons/region.lua index 800f4990864..1b10bfcb9a6 100644 --- a/standard/region/commons/region.lua +++ b/standard/region/commons/region.lua @@ -14,8 +14,7 @@ local String = require('Module:StringUtils') local Table = require('Module:Table') local REGION_DATA = mw.loadData('Module:Region/Data') -local COUNTRY_TO_REGION_DATA = Lua.requireIfExists('Module:Region/CountryData', - {requireDevIfEnabled = true, loadData = true}) or {} +local COUNTRY_TO_REGION_DATA = Lua.requireIfExists('Module:Region/CountryData', {loadData = true}) or {} local NO_ENTRY_FOUND_CATEGORY = 'Pages using unsupported region values' diff --git a/standard/test/json_test.lua b/standard/test/json_test.lua index c31e448c444..f71d07123d4 100644 --- a/standard/test/json_test.lua +++ b/standard/test/json_test.lua @@ -9,7 +9,7 @@ local Lua = require('Module:Lua') local ScribuntoUnit = require('Module:ScribuntoUnit') -local Json = Lua.import('Module:Json', {requireDevIfEnabled = true}) +local Json = Lua.import('Module:Json') local suite = ScribuntoUnit:new()