diff mbox series

[v2,01/13] bitbake-setup: Resolve unused loop control variables

Message ID 20260331160703.3137930-2-rob.woolley@windriver.com
State New
Headers show
Series bitbake-setup PyPI Packaging | expand

Commit Message

Woolley, Rob March 31, 2026, 4:06 p.m. UTC
The ruff lint tool reported loop control variables that were
not being used:
    B007 Loop control variable `dirs` not used within loop body

Adding underscore as a prefix helps indicate that it is not
being used inside the loop.

Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
---
 bin/bitbake-setup | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Richard Purdie April 1, 2026, 9:44 p.m. UTC | #1
On Tue, 2026-03-31 at 09:06 -0700, Rob Woolley via lists.openembedded.org wrote:
> The ruff lint tool reported loop control variables that were
> not being used:
>     B007 Loop control variable `dirs` not used within loop body
> 
> Adding underscore as a prefix helps indicate that it is not
> being used inside the loop.
> 
> Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
> ---
>  bin/bitbake-setup | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/bin/bitbake-setup b/bin/bitbake-setup
> index b02cbc2b1..304fbe6cc 100755
> --- a/bin/bitbake-setup
> +++ b/bin/bitbake-setup
> @@ -134,7 +134,7 @@ def commit_config(config_dir):
>  def _write_layer_list(dest, repodirs):
>      layers = []
>      for r in repodirs:
> -        for root, dirs, files in os.walk(os.path.join(dest,r)):
> +        for root, _dirs, files in os.walk(os.path.join(dest,r)):
>              if os.path.basename(root) == 'conf' and 'layer.conf' in files:
>                  layers.append(os.path.relpath(os.path.dirname(root), dest))
>      layers_f = os.path.join(dest, ".oe-layers.json")

I'd suggest just using "_" alone as the name as that is how we do it everywhere else.

Cheers,

Richard
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index b02cbc2b1..304fbe6cc 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -134,7 +134,7 @@  def commit_config(config_dir):
 def _write_layer_list(dest, repodirs):
     layers = []
     for r in repodirs:
-        for root, dirs, files in os.walk(os.path.join(dest,r)):
+        for root, _dirs, files in os.walk(os.path.join(dest,r)):
             if os.path.basename(root) == 'conf' and 'layer.conf' in files:
                 layers.append(os.path.relpath(os.path.dirname(root), dest))
     layers_f = os.path.join(dest, ".oe-layers.json")
@@ -445,7 +445,7 @@  The bitbake configuration files (local.conf, bblayers.conf and more) can be foun
         configure_vscode(setupdir, layerdir, bitbake_builddir, init_script)
 
 def get_registry_config(registry_path, id):
-    for root, dirs, files in os.walk(registry_path):
+    for root, _dirs, files in os.walk(registry_path):
         for f in files:
             if f.endswith('.conf.json') and id == get_config_name(f):
                 return os.path.join(root, f)
@@ -996,7 +996,7 @@  def has_expired(expiry_date):
 def list_registry(registry_path, with_expired):
     json_data = {}
 
-    for root, dirs, files in os.walk(registry_path):
+    for root, _dirs, files in os.walk(registry_path):
         for f in files:
             if f.endswith('.conf.json'):
                 config_name = get_config_name(f)