Skip to content

Commit

Permalink
wmllint: change "usage of" magic comment to re.search
Browse files Browse the repository at this point in the history
There seems no particular reason to require that this magic comment be at
the very beginning of the line, so why not switch from re.match to
re.search.

Also, update comments to reflect the fact that UtBS no longer uses this
magic comment.

A suggestion has been made to get rid of this magic comment now that UtBS
is no longer using it, but it may still be in use in some UMC somewhere.
  • Loading branch information
groggyd88 committed Apr 25, 2014
1 parent 0aebc80 commit 2740384
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions data/tools/wmllint
Expand Up @@ -100,7 +100,8 @@
# wmllint: usage of <unit> is <class>
# Note that <unit> must be a string wrapped in ASCII doublequotes. This
# declaration will be useful if you are declaring units with macros that
# include a substitutable formal in the unit name; there are examples in UtBS.
# include a substitutable formal in the unit name; there were examples in
# UtBS, but they have since been converted to use the [base_unit] tag.
#
# If a mismatch between a recruit list and recruitment pattern involves a
# usage type outside the five core types, the warning message will include a
Expand Down Expand Up @@ -1321,10 +1322,10 @@ def global_sanity_check(filename, lines):
# Interpret various magic comments
for i in xrange(len(lines)):
# Interpret magic comments for setting the usage pattern of units.
# This copes with some wacky UtBS units that are defined with
# This coped with some wacky UtBS units that were defined with
# variant-spawning macros. The prototype comment looks like this:
#wmllint: usage of "Desert Fighter" is fighter
m = re.match('# *wmllint: usage of "([^"]*)" is +(.*)', lines[i])
m = re.search('# *wmllint: usage of "([^"]*)" is +(.*)', lines[i])
if m:
usage[m.group(1)] = m.group(2).strip()
unit_types.append(m.group(1))
Expand Down

0 comments on commit 2740384

Please sign in to comment.