make sure that source is not a directory
Also fix wrong variable name in logging messages. Change-Id: Ic5b03714b258859a0eb4a4004b13857ee2b1ae5d
This commit is contained in:
parent
555a1cded6
commit
a343ec6c45
@ -232,7 +232,7 @@ def check_file(src, rules, disabled):
|
||||
if rule.get('description') in disabled:
|
||||
continue
|
||||
|
||||
logger.debug("%s: checking rule '%s'.", file,
|
||||
logger.debug("%s: checking rule '%s'.", src,
|
||||
rule.get('description'))
|
||||
logger.debug(rule.get('find'))
|
||||
newcontent, count = rule.get('regex').subn(
|
||||
@ -240,7 +240,7 @@ def check_file(src, rules, disabled):
|
||||
)
|
||||
|
||||
if count > 0:
|
||||
logger.warning("%d match(s) in file %s : %s.", count, file,
|
||||
logger.warning("%d match(s) in file %s : %s.", count, src,
|
||||
rule.get('description'))
|
||||
findings += count
|
||||
content = newcontent
|
||||
@ -281,6 +281,8 @@ def main():
|
||||
|
||||
all_findings = 0
|
||||
for check in files:
|
||||
if not os.path.isfile(check):
|
||||
continue
|
||||
|
||||
(findings, content) = check_file(check, rules, disabled)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user