From 1cb6163bd0fe1a956aad2beee9351dbd2b0f0d28 Mon Sep 17 00:00:00 2001
From: Garrett Beaty <gbeaty@chromium.org>
Date: Tue, 14 Jun 2022 18:57:44 +0000
Subject: [PATCH 13/59] [M102][infra] Fix future lint warnings.

The upcoming version of lucicfg has updated buildifier library
that has more lint checks (in particular stricter 'unused-variable'
and 'return-value' checks). To avoid breaking validation of
Chromium configs, this CL fixes them in advance.

(cherry picked from commit bbf8109aaa463dcd34a1196bd170999fed50a1a3)

Change-Id: I0eb2406b30c93cbf9efba188887884ace520aa0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3703880
Auto-Submit: Garrett Beaty <gbeaty@google.com>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Garrett Beaty <gbeaty@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#1014084}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3705899
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5005@{#1172}
Cr-Branched-From: 5b4d9450fee01f821b6400e947b3839727643a71-refs/heads/main@{#992738}
---
 infra/config/lib/args.star        |  2 ++
 infra/config/lib/consoles.star    | 11 ++++-------
 infra/config/outages/outages.star |  2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/infra/config/lib/args.star b/infra/config/lib/args.star
index 2f3bbb42a57f..a5947a9485c2 100644
--- a/infra/config/lib/args.star
+++ b/infra/config/lib/args.star
@@ -96,6 +96,8 @@ def defaults(extends = None, **vars):
                 return listify(value)
             return listify(default, value)
 
+        fail("unknown merge value: {}".format(merge))
+
     def get_value_from_kwargs(name, kwargs, merge = None):
         return get_value(name, kwargs.get(name, DEFAULT), merge = merge)
 
diff --git a/infra/config/lib/consoles.star b/infra/config/lib/consoles.star
index 3eed963fa62d..d07a73baf77d 100644
--- a/infra/config/lib/consoles.star
+++ b/infra/config/lib/consoles.star
@@ -40,7 +40,7 @@ defaults = args.defaults(
 _CONSOLE_VIEW_ORDERING = nodes.create_unscoped_node_type("console_view_ordering")
 _OVERVIEW_CONSOLE_ORDERING = nodes.create_unscoped_node_type("overview_console_ordering")
 
-def _console_view_ordering_impl(ctx, *, console_name, ordering):
+def _console_view_ordering_impl(_ctx, *, console_name, ordering):
     key = _CONSOLE_VIEW_ORDERING.add(console_name, props = {
         "ordering": ordering,
     })
@@ -49,7 +49,7 @@ def _console_view_ordering_impl(ctx, *, console_name, ordering):
 
 _console_view_ordering = lucicfg.rule(impl = _console_view_ordering_impl)
 
-def _overview_console_view_ordering_impl(ctx, *, console_name, top_level_ordering):
+def _overview_console_view_ordering_impl(_ctx, *, console_name, top_level_ordering):
     key = _OVERVIEW_CONSOLE_ORDERING.add(console_name, props = {
         "top_level_ordering": top_level_ordering,
     })
@@ -266,7 +266,7 @@ def console_view(*, name, branch_selector = branches.MAIN, ordering = None, **kw
         ordering = ordering or {},
     )
 
-def overview_console_view(*, name, top_level_ordering, branch_selector = branches.MAIN, **kwargs):
+def overview_console_view(*, name, top_level_ordering, **kwargs):
     """Create an overview console view.
 
     An overview console view is a console view that contains a subset of
@@ -285,9 +285,6 @@ def overview_console_view(*, name, top_level_ordering, branch_selector = branche
         name does not appear in the list will be sorted lexicographically
         by the console name and appear after entries whose console does
         appear in the list.
-      branch_selector - A branch selector value controlling whether the
-        console view definition is executed. See branches.star for
-        more information.
       kwargs - Additional keyword arguments to forward on to
         `luci.console_view`. The header and repo arguments support
          module-level defaults.
@@ -351,7 +348,7 @@ def _get_list_view_key_fn(console_name):
         return None
     return lambda b: b.name
 
-def _sorted_list_view_impl(ctx, *, console_name):
+def _sorted_list_view_impl(_ctx, *, console_name):
     key = _sorted_list_view_graph_key(console_name)
     graph.add_node(key)
     graph.add_edge(keys.project(), key)
diff --git a/infra/config/outages/outages.star b/infra/config/outages/outages.star
index 16736121c21e..6ada1be72649 100644
--- a/infra/config/outages/outages.star
+++ b/infra/config/outages/outages.star
@@ -33,7 +33,7 @@ def _disable_cq_experiments(ctx):
         for b in c.verifiers.tryjob.builders:
             if not b.experiment_percentage:
                 continue
-            project, bucket, builder = b.name.split("/", 2)
+            project, bucket, _ = b.name.split("/", 2)
             if project == "chromium" and bucket == "try":
                 b.includable_only = True
                 b.experiment_percentage = 0
-- 
2.37.0

