wmllint: validate values of [campaign] rank=
This commit is contained in:
parent
7ddf691e13
commit
c1a074ea41
2 changed files with 15 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
|||
### User interface
|
||||
### WML Engine
|
||||
### Miscellaneous and Bug Fixes
|
||||
* wmllint now validates `rank=` values in `[campaign]` (issue #7224)
|
||||
|
||||
## Version 1.17.11
|
||||
### Campaigns
|
||||
|
|
|
@ -1687,6 +1687,20 @@ def local_sanity_check(filename, nav, key, prefix, value, comment):
|
|||
nextrefs.append((filename, nav.lineno, value))
|
||||
if key == 'id':
|
||||
scenario_to_filename[value] = filename
|
||||
# Check for campaign rank and warn if an unconventional value is found
|
||||
if parent == "[campaign]":
|
||||
if key == "rank" and not ignored:
|
||||
try:
|
||||
campaign_rank = int(value)
|
||||
# assume that UMCs are into the data/add-ons directory and mainline is into data/campaigns
|
||||
if "add-ons" in filename:
|
||||
if campaign_rank < 300:
|
||||
print(errlead + "rank for add-on campaigns should be greater than or equal to 300")
|
||||
else:
|
||||
if campaign_rank >= 300 or (campaign_rank % 5) != 0:
|
||||
print(errlead + "rank for mainline campaigns should be a multiple of 5 between 0 and 300")
|
||||
except ValueError:
|
||||
print(errlead + "rank must be a numeric value")
|
||||
|
||||
def global_sanity_check_events(filename, lines):
|
||||
"""Part of global_sanity_check which finds each [event] tag.
|
||||
|
|
Loading…
Add table
Reference in a new issue