mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
Fix no-underscore-variable test. (#54137)
* Ignore lines with comments. * Detect variables at the start of the line.
This commit is contained in:
@@ -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' % (
|
||||
|
||||
Reference in New Issue
Block a user