projects
/
kconfig-hardened-check.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
12c2af7
)
Add the CmdlineCheck class
author
Alexander Popov
<alex.popov@linux.com>
Sun, 27 Mar 2022 18:25:04 +0000
(21:25 +0300)
committer
Alexander Popov
<alex.popov@linux.com>
Sat, 28 May 2022 16:12:28 +0000
(19:12 +0300)
kconfig_hardened_check/__init__.py
patch
|
blob
|
history
diff --git
a/kconfig_hardened_check/__init__.py
b/kconfig_hardened_check/__init__.py
index 9b3c94c6c33cf0f062233a7d80f2dc8da5470ec1..17bf7bebca5f7b852773435f8499009ff4a542b2 100644
(file)
--- a/
kconfig_hardened_check/__init__.py
+++ b/
kconfig_hardened_check/__init__.py
@@
-132,6
+132,12
@@
class OptCheck:
if with_results:
print('| {}'.format(self.result), end='')
if with_results:
print('| {}'.format(self.result), end='')
+ def json_dump(self, with_results):
+ dump = [self.name, self.type, self.expected, self.decision, self.reason]
+ if with_results:
+ dump.append(self.result)
+ return dump
+
class KconfigCheck(OptCheck):
def __init__(self, *args, **kwargs):
class KconfigCheck(OptCheck):
def __init__(self, *args, **kwargs):
@@
-142,11
+148,11
@@
class KconfigCheck(OptCheck):
def type(self):
return 'kconfig'
def type(self):
return 'kconfig'
- def json_dump(self, with_results):
- dump = [self.name, self.type, self.expected, self.decision, self.reason]
- if with_results:
- dump.append(self.result)
- return
dump
+
+class CmdlineCheck(OptCheck):
+ @property
+ def type(self):
+ return
'cmdline'
class VersionCheck:
class VersionCheck:
@@
-185,7
+191,7
@@
class ComplexOptCheck:
sys.exit('[!] ERROR: empty {} check'.format(self.__class__.__name__))
if len(self.opts) == 1:
sys.exit('[!] ERROR: useless {} check'.format(self.__class__.__name__))
sys.exit('[!] ERROR: empty {} check'.format(self.__class__.__name__))
if len(self.opts) == 1:
sys.exit('[!] ERROR: useless {} check'.format(self.__class__.__name__))
- if not isinstance(opts[0], KconfigCheck):
+ if not isinstance(opts[0], KconfigCheck)
and not isinstance(opts[0], CmdlineCheck)
:
sys.exit('[!] ERROR: invalid {} check: {}'.format(self.__class__.__name__, opts))
self.result = None
sys.exit('[!] ERROR: invalid {} check: {}'.format(self.__class__.__name__, opts))
self.result = None