Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kernel-hardening-checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
kernel-hardening-checker
Commits
38b6bbb2
Commit
38b6bbb2
authored
Feb 15, 2022
by
Alexander Popov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce the json_dump() class method
parent
b68df4d3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
__init__.py
kconfig_hardened_check/__init__.py
+15
-6
No files found.
kconfig_hardened_check/__init__.py
View file @
38b6bbb2
...
...
@@ -122,6 +122,12 @@ class KconfigCheck(OptCheck):
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
VersionCheck
:
def
__init__
(
self
,
ver_expected
):
...
...
@@ -221,6 +227,12 @@ class ComplexOptCheck:
if
with_results
:
print
(
'| {}'
.
format
(
self
.
result
),
end
=
''
)
def
json_dump
(
self
,
with_results
):
dump
=
self
.
opts
[
0
]
.
json_dump
(
False
)
if
with_results
:
dump
.
append
(
self
.
result
)
return
dump
class
OR
(
ComplexOptCheck
):
# self.opts[0] is the option that this OR-check is about.
...
...
@@ -645,13 +657,10 @@ def print_unknown_options(checklist, parsed_options):
def
print_checklist
(
mode
,
checklist
,
with_results
):
if
mode
==
'json'
:
o
pts
=
[]
o
utput
=
[]
for
o
in
checklist
:
opt
=
[
o
.
name
,
o
.
type
,
o
.
expected
,
o
.
decision
,
o
.
reason
]
if
with_results
:
opt
.
append
(
o
.
result
)
opts
.
append
(
opt
)
print
(
json
.
dumps
(
opts
))
output
.
append
(
o
.
json_dump
(
with_results
))
print
(
json
.
dumps
(
output
))
return
# table header
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment