scripts: compliance: move binding file cycle in run()
Move the file iteration loops of the bindings compliance check in the callers, so that if we add more checks we don't have iterate on each one of them and a check works on a single file. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
4d9b6c4e2e
commit
afc2ad34bd
1 changed files with 17 additions and 17 deletions
|
@ -225,9 +225,10 @@ class DevicetreeBindingsCheck(ComplianceTest):
|
|||
path_hint = "<zephyr-base>"
|
||||
|
||||
def run(self, full=True):
|
||||
dts_yaml = self.parse_dt_bindings()
|
||||
dts_bindings = self.parse_dt_bindings()
|
||||
|
||||
self.required_false_check(dts_yaml)
|
||||
for dts_binding in dts_bindings:
|
||||
self.required_false_check(dts_binding)
|
||||
|
||||
def parse_dt_bindings(self):
|
||||
"""
|
||||
|
@ -241,21 +242,20 @@ class DevicetreeBindingsCheck(ComplianceTest):
|
|||
|
||||
return dt_bindings
|
||||
|
||||
def required_false_check(self, dt_bindings):
|
||||
for file_name in dt_bindings:
|
||||
def required_false_check(self, dts_binding):
|
||||
try:
|
||||
with open(file_name) as file:
|
||||
with open(dts_binding) as file:
|
||||
line_number = 0
|
||||
for line in file:
|
||||
line_number += 1
|
||||
if 'required: false' in line:
|
||||
self.fmtd_failure(
|
||||
'warning', 'Devicetree Bindings', file_name,
|
||||
'warning', 'Devicetree Bindings', dts_binding,
|
||||
line_number, col=None,
|
||||
desc="'required: false' is redundant, please remove")
|
||||
except Exception:
|
||||
# error opening file (it was likely deleted by the commit)
|
||||
continue
|
||||
return
|
||||
|
||||
|
||||
class KconfigCheck(ComplianceTest):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue