Move the add_cmdline_checks() call earlier
[kconfig-hardened-check.git] / kconfig_hardened_check / __init__.py
index 0c58c0ca9e5b8443429b967fd37ec9ff93e51ce0..2938c98682f556693af43db9db6124f1ebd11047 100644 (file)
@@ -189,7 +189,7 @@ class ComplexOptCheck:
                'empty {} check'.format(self.__class__.__name__)
         assert(len(self.opts) != 1), \
                 'useless {} check: {}'.format(self.__class__.__name__, opts)
-        assert(isinstance(opts[0], KconfigCheck) or isinstance(opts[0], CmdlineCheck)), \
+        assert(isinstance(opts[0], (KconfigCheck, CmdlineCheck))), \
                'invalid {} check: {}'.format(self.__class__.__name__, opts)
         self.result = None
 
@@ -864,6 +864,10 @@ def main():
         # add relevant kconfig checks to the checklist
         add_kconfig_checks(config_checklist, arch)
 
+        if args.cmdline:
+            # add relevant cmdline checks to the checklist
+            add_cmdline_checks(config_checklist, arch)
+
         # populate the checklist with the parsed kconfig data
         parsed_kconfig_options = OrderedDict()
         parse_kconfig_file(parsed_kconfig_options, args.config)
@@ -871,9 +875,6 @@ def main():
         populate_with_data(config_checklist, kernel_version, 'version')
 
         if args.cmdline:
-            # add relevant cmdline checks to the checklist
-            add_cmdline_checks(config_checklist, arch)
-
             # populate the checklist with the parsed kconfig data
             parsed_cmdline_options = OrderedDict()
             parse_cmdline_file(parsed_cmdline_options, args.cmdline)
@@ -904,6 +905,3 @@ def main():
 
     parser.print_help()
     sys.exit(0)
-
-if __name__ == '__main__':
-    main()