From 1f99516dc0cc0e3243e6c870b141b6a613b81d7a Mon Sep 17 00:00:00 2001 From: Andrea Righi Date: Fri, 20 Oct 2023 09:42:57 +0200 Subject: [PATCH] annotations: update: update note when config is changing When a new .config is imported some values may change, but the corresponding note is not always updated to reflect the new value. This is wrong and it can lead to errors and incorrect information in the annotations file. To prevent this from happening automatically add a TODO note when any config with a note is changing to force the reviewer to update the note. Signed-off-by: Andrea Righi --- kconfig/annotations.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kconfig/annotations.py b/kconfig/annotations.py index 7a23d2b..145523c 100644 --- a/kconfig/annotations.py +++ b/kconfig/annotations.py @@ -238,6 +238,14 @@ class Annotation(Config): val = "-" if conf in self.config: if "policy" in self.config[conf]: + # Add a TODO if a config with a note is changing and print + # a warning + old_val = self.search_config(config=conf, arch=arch, flavour=flavour) + if old_val: + old_val = old_val[conf] + if val != old_val and "note" in self.config[conf]: + self.config[conf]['note'] = "TODO: update note" + print(f"WARNING: {conf} changed from {old_val} to {val}, updating note") self.config[conf]["policy"][flavour] = val else: self.config[conf]["policy"] = {flavour: val} -- 2.31.1