wmllint: fix "local variable 'unit_id' referenced before assignment"
In global_sanity_check(), variables "unit_id" and "base_unit" can be used before assignment. This happens, for example, in this WML file: https://github.com/Dugy/Legend_of_the_Invincibles/blob/master/utils/amla.cfg#L65 ... where there is a [/unit_type] tag without the matching [unit_type]. (these variables are normally initialized when [unit_type] is found)
This commit is contained in:
parent
eba9987cc2
commit
d5d23fb523
1 changed files with 2 additions and 0 deletions
|
@ -1347,6 +1347,8 @@ def global_sanity_check(filename, lines):
|
|||
notecheck = True
|
||||
trait_note = dict(notepairs)
|
||||
note_trait = {p[1]:p[0] for p in notepairs}
|
||||
unit_id = ""
|
||||
base_unit = ""
|
||||
for nav in WmllintIterator(lines, filename):
|
||||
if "wmllint: notecheck off" in nav.text:
|
||||
notecheck = False
|
||||
|
|
Loading…
Add table
Reference in a new issue