Skip to content

Commit

Permalink
Fix wrong comment handling in wmllint
Browse files Browse the repository at this point in the history
A comment containing a string [advancefrom] was causing wmllint to get confused

../../data/campaigns/Dead_Water/scenarios/06_Uncharted_Islands.cfg, line 22: [advancefrom] needs to be manually updated to [modify_unit_type] and moved into the _main.cfg file
  • Loading branch information
hexagonrecursion committed Jan 14, 2021
1 parent 92fedf8 commit 48d001a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions data/tools/wmllint
Expand Up @@ -1804,13 +1804,14 @@ def global_sanity_check(filename, lines):
# 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:
precomment = line.split("#")[0]
if "[campaign]" in precomment:
in_campaign = True
continue
if "[/campaign]" in line:
if "[/campaign]" in precomment:
in_campaign = False
continue
if has_opening_tag(line, "advancefrom"):
if has_opening_tag(precomment, "advancefrom"):
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:
Expand Down

0 comments on commit 48d001a

Please sign in to comment.