Skip to content

Commit

Permalink
refactor: remove remaining unneeded requireDevIfEnabled=true (#3778)
Browse files Browse the repository at this point in the history
* refactor: remove unneeded `requireDevIfEnabled=true`

* refactor: remove unneeded `requireDevIfEnabled=true`

* update comment

---------

Co-authored-by: hjpalpha <[email protected]>
  • Loading branch information
Rathoz and hjpalpha authored Jan 15, 2024
1 parent e6f0a71 commit 7c5863e
Show file tree
Hide file tree
Showing 23 changed files with 45 additions and 55 deletions.
2 changes: 1 addition & 1 deletion components/infobox/commons/infobox_widget_links.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions components/infobox/wikis/esports/infobox_game_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions components/infobox/wikis/stormgate/infobox_map_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/match2/commons/get_match_group_copy_paste.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

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 @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
5 changes: 1 addition & 4 deletions components/match2/wikis/starcraft/brkts_wiki_specific.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions components/match2/wikis/starcraft2/brkts_wiki_specific.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions components/match2/wikis/stormgate/brkts_wiki_specific.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion standard/links/commons/links.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand Down
8 changes: 4 additions & 4 deletions standard/lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion standard/mock/mock_lpdb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
3 changes: 1 addition & 2 deletions standard/region/commons/region.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion standard/test/json_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 7c5863e

Please sign in to comment.