mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix no-underscore-variable test. (#54137)
* Ignore lines with comments. * Detect variables at the start of the line.
This commit is contained in:
parent
c431d18e28
commit
47f2101e8d
1 changed files with 1 additions and 1 deletions
|
@ -127,7 +127,7 @@ def main():
|
||||||
|
|
||||||
with open(path, 'r') as path_fd:
|
with open(path, 'r') as path_fd:
|
||||||
for line, text in enumerate(path_fd.readlines()):
|
for line, text in enumerate(path_fd.readlines()):
|
||||||
match = re.search(r'(?: |[^C]\()(_)(?:[ ,)])', text)
|
match = re.search(r'^[^#]*(?:^| |[^C]\()(_)(?:[ ,)])', text)
|
||||||
|
|
||||||
if match:
|
if match:
|
||||||
print('%s:%d:%d: use `dummy` instead of `_` for a variable name' % (
|
print('%s:%d:%d: use `dummy` instead of `_` for a variable name' % (
|
||||||
|
|
Loading…
Reference in a new issue