Skip to content

Commit

Permalink
wmllint: implemented warnings about [advancefrom] -> [modify_unit_typ…
Browse files Browse the repository at this point in the history
…e] and extra_defines
  • Loading branch information
Elvish-Hunter committed Apr 19, 2020
1 parent a0d787d commit b97d2e6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions data/tools/wmllint
Expand Up @@ -1763,6 +1763,29 @@ def global_sanity_check(filename, lines):
print('"%s", line %d: custom ellipse %s may need to be updated' % (filename, num, value))
except TypeError: # this is needed to handle tags, that parse_attribute cannot split
pass
# Handle [advancefrom] deprecation
# it should be replaced with [modify_unit_type]
# but, unlike the former tag, the new one goes in the _main.cfg, even as a macro call
# Because we can't be sure about what the UMC author wants to do, just warn
in_campaign = False
for num, line in enumerate(lines, start=1):
if "[campaign]" in line:
in_campaign = True
continue
if "[/campaign]" in line:
in_campaign = False
continue
if "[advancefrom]" in line:
print("{}, line {}: [advancefrom] needs to be manually updated to \
[modify_unit_type] and moved into the _main.cfg file".format(filename, num))
if in_campaign:
try:
(key, prefix, value, comment) = parse_attribute(line)
if key == "extra_defines":
print("{}, line {}: extra_defines are now macros and need \
to be called on their own".format(filename, num))
except TypeError:
pass
# Interpret various magic comments
for line in lines:
# Interpret magic comments for setting the usage pattern of units.
Expand Down

0 comments on commit b97d2e6

Please sign in to comment.