Fix no-underscore-variable test. (#54137)

* Ignore lines with comments.
* Detect variables at the start of the line.
pull/53889/head
Matt Clay 5 years ago committed by Matt Davis
parent c431d18e28
commit 47f2101e8d

@ -127,7 +127,7 @@ def main():
with open(path, 'r') as path_fd:
for line, text in enumerate(path_fd.readlines()):
match = re.search(r'(?: |[^C]\()(_)(?:[ ,)])', text)
match = re.search(r'^[^#]*(?:^| |[^C]\()(_)(?:[ ,)])', text)
if match:
print('%s:%d:%d: use `dummy` instead of `_` for a variable name' % (

Loading…
Cancel
Save