diff mbox series

[05/18] checkpackagelib/lib_config.py: CommentsMenusPackagesOrder: change the type of variable 'new_package'

Message ID 20190903211341.10341-5-jerzy.m.grzegorek@gmail.com
State Superseded
Headers show
Series Improve alphabetical order checking of Config.in files | expand

Commit Message

Jerzy Grzegorek Sept. 3, 2019, 9:13 p.m. UTC
Change the type of variable 'new_package' to make it a class member.
It will be used not only locally.
Also initialize it.

Signed-off-by: Jerzy Grzegorek <jerzy.m.grzegorek@gmail.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 utils/checkpackagelib/lib_config.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Ricardo Martincoski Sept. 25, 2019, 2:08 a.m. UTC | #1
Hello,

On Tue, Sep 03, 2019 at 06:13 PM, Jerzy Grzegorek wrote:

> Change the type of variable 'new_package' to make it a class member.
> It will be used not only locally.
> Also initialize it.
> 
> Signed-off-by: Jerzy Grzegorek <jerzy.m.grzegorek@gmail.com>
> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

Reviewed-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>

In this patch you correctly did the initialization I talked about in the
review to patch 2.


Regards,
Ricardo
diff mbox series

Patch

diff --git a/utils/checkpackagelib/lib_config.py b/utils/checkpackagelib/lib_config.py
index f8bfe6a577..de5faa19a2 100644
--- a/utils/checkpackagelib/lib_config.py
+++ b/utils/checkpackagelib/lib_config.py
@@ -67,6 +67,7 @@  class CommentsMenusPackagesOrder(_CheckFunction):
 
     def before(self):
         self.state = ""
+        self.new_package = ""
 
     def get_level(self):
         return len(self.state.split('-')) - 1
@@ -122,10 +123,10 @@  class CommentsMenusPackagesOrder(_CheckFunction):
             self.level = self.get_level()
 
         elif source_line:
-            new_package = source_line.group(1)
+            self.new_package = source_line.group(1)
 
             # We order _ before A, so replace it with .
-            new_package_ord = new_package.replace('_', '.')
+            new_package_ord = self.new_package.replace('_', '.')
 
             if self.package[self.level] != "" and \
                self.print_package_warning[self.level] and \
@@ -139,7 +140,7 @@  class CommentsMenusPackagesOrder(_CheckFunction):
                         "{spaces}first incorrect package: {package}"
                         .format(prefix=prefix, spaces=spaces,
                                 menu=self.menu_of_packages[self.level],
-                                package=new_package),
+                                package=self.new_package),
                         text]
 
             self.package[self.level] = new_package_ord