From: Alexander Popov Date: Tue, 24 Jul 2018 22:36:25 +0000 (+0300) Subject: Improve the OR result calculation X-Git-Tag: v0.5.2~85^2~1 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=7edb9d258672896f80f772a268e0af620ff43c6a;p=kconfig-hardened-check.git Improve the OR result calculation 1. don't duplicate opts[0].name in the successful output; 2. fix the bug with printing None state, just reuse the OptCheck.result. --- diff --git a/kconfig-hardened-check.py b/kconfig-hardened-check.py index 8d1ecdf..e8b846c 100755 --- a/kconfig-hardened-check.py +++ b/kconfig-hardened-check.py @@ -83,12 +83,15 @@ class OR: return self.opts[0].reason def check(self): - for opt in self.opts: + for i, opt in enumerate(self.opts): result, msg = opt.check() if result: - self.result = 'OK (CONFIG_{} {})'.format(opt.name, opt.state) - return result, self.result - self.result = 'FAIL: "{}"'.format(self.opts[0].state) + if i == 0: + self.result = opt.result + else: + self.result = 'CONFIG_{}: {} ("{}")'.format(opt.name, opt.result, opt.expected) + return True, self.result + self.result = self.opts[0].result return False, self.result