Skip to content

Commit

Permalink
chore: suppress buildifier lint warnings
Browse files Browse the repository at this point in the history
Our goal is just to prevent new ones getting added by turning on buildifier enforcement in CI.
  • Loading branch information
alexeagle committed Nov 6, 2023
1 parent eb46104 commit e13364c
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 16 deletions.
11 changes: 6 additions & 5 deletions examples/where_is_my_output/show_all_outputs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Extract the paths to the various outputs of pkg_deb
# Extract the paths to the various outputs of pkg_deb
#
# Usage:
# bazel cquery //pkg:deb --output=starlark --starlark:file=show_all_outputs.bzl
#
Usage:
bazel cquery //pkg:deb --output=starlark --starlark:file=show_all_outputs.bzl
"""

# buildifier: disable=function-docstring
def format(target):
provider_map = providers(target)
output_group_info = provider_map["OutputGroupInfo"]
Expand Down
1 change: 0 additions & 1 deletion pkg/install.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ load("//pkg/private:pkg_files.bzl", "create_mapping_context_from_ctx", "process_
def _pkg_install_script_impl(ctx):
script_file = ctx.actions.declare_file(ctx.attr.name + ".py")

fragments = []
mapping_context = create_mapping_context_from_ctx(ctx, label = ctx.label, default_mode = "0644")
for src in ctx.attr.srcs:
process_src(
Expand Down
2 changes: 1 addition & 1 deletion pkg/private/pkg_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _process_pkg_symlink(mapping_context, pkg_symlink_info, origin):
link_to = pkg_symlink_info.target,
)

def _process_pkg_filegroup(mapping_context, pkg_filegroup_info, origin):
def _process_pkg_filegroup(mapping_context, pkg_filegroup_info, _):
if hasattr(pkg_filegroup_info, "pkg_dirs"):
for d in pkg_filegroup_info.pkg_dirs:
_process_pkg_dirs(mapping_context, d[0], d[1])
Expand Down
3 changes: 1 addition & 2 deletions pkg/releasing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ package(

filegroup(
name = "standard_package",
srcs = glob([
"BUILD",
srcs = ["BUILD"] + glob([
"*.bzl",
"*.py",
]),
Expand Down
1 change: 1 addition & 0 deletions pkg/releasing/defs.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Implementation for print_rel_notes."""

# buildifier: disable=function-docstring
def print_rel_notes(
name,
repo,
Expand Down
6 changes: 3 additions & 3 deletions pkg/rpm_pfg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def _process_files(pfi, origin_label, grouping_label, file_base, dest_check_map,
abs_dest,
))

def _process_dirs(pdi, origin_label, grouping_label, file_base, dest_check_map, packaged_directories, rpm_files_list, install_script_pieces):
def _process_dirs(pdi, origin_label, grouping_label, file_base, dest_check_map, _, rpm_files_list, install_script_pieces):
for dest in pdi.dirs:
metadata = _package_contents_metadata(origin_label, grouping_label)
if dest in dest_check_map:
Expand All @@ -195,7 +195,7 @@ def _process_dirs(pdi, origin_label, grouping_label, file_base, dest_check_map,
abs_dirname,
))

def _process_symlink(psi, origin_label, grouping_label, file_base, dest_check_map, packaged_directories, rpm_files_list, install_script_pieces):
def _process_symlink(psi, origin_label, grouping_label, file_base, dest_check_map, _, rpm_files_list, install_script_pieces):
metadata = _package_contents_metadata(origin_label, grouping_label)
if psi.destination in dest_check_map:
_conflicting_contents_error(psi.destination, metadata, dest_check_map[psi.destination])
Expand Down Expand Up @@ -258,7 +258,7 @@ def _pkg_rpm_impl(ctx):
ctx.attr.architecture,
)

outputs, output_file, output_name = setup_output_files(
_, output_file, _ = setup_output_files(
ctx,
package_file_name = package_file_name,
default_output_file = default_file,
Expand Down
1 change: 1 addition & 0 deletions pkg/verify_archive.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ _gen_verify_archive_test_main = rule(
},
)

# buildifier: disable=function-docstring-args
def verify_archive_test(
name,
target,
Expand Down
3 changes: 2 additions & 1 deletion tests/mappings/mappings_external_repo_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

"""Tests for file mapping routines in pkg/mappings.bzl"""

load(":mappings_test.bzl", "pkg_files_contents_test")
load("//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load(":mappings_test.bzl", "pkg_files_contents_test")

##########
# pkg_files tests involving external repositories
Expand Down Expand Up @@ -106,6 +106,7 @@ def _test_pkg_files_extrepo():
expected_dests = ["usr/bin/dir/extproj.sh"],
)

# buildifier: disable=unnamed-macro
def mappings_external_repo_analysis_tests():
"""Declare mappings.bzl analysis tests"""
_test_pkg_files_extrepo()
Expand Down
2 changes: 2 additions & 0 deletions tests/mappings/mappings_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ def _strip_prefix_test_impl(ctx):

strip_prefix_test = unittest.make(_strip_prefix_test_impl)

# buildifier: disable=unnamed-macro
def mappings_analysis_tests():
"""Declare mappings.bzl analysis tests"""
_test_pkg_files_contents()
Expand Down Expand Up @@ -969,6 +970,7 @@ _gen_manifest_test_main = rule(
},
)

# buildifier: disable=function-docstring-args
def manifest_golden_test(name, target, expected):
"""Tests that a content manifest file matches a golden copy.
Expand Down
6 changes: 3 additions & 3 deletions tests/rpm/analysis_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _declare_pkg_rpm(name, srcs_ungrouped, tags = None, **kwargs):
**kwargs
)

def _declare_conflicts_test(name, srcs, **kwargs):
def _declare_conflicts_test(name, srcs):
rpm_name = name + "_rpm"
_declare_pkg_rpm(
name = rpm_name,
Expand Down Expand Up @@ -226,7 +226,7 @@ package_naming_test = analysistest.make(
)

# Dummy substitution set, used in below test cases
def _dummy_pkg_variables_impl(ctx):
def _dummy_pkg_variables_impl(_):
return [
PackageVariablesInfo(
values = {
Expand Down Expand Up @@ -302,7 +302,7 @@ def _test_naming(name):
],
)

def analysis_tests(name, **kwargs):
def analysis_tests(name):
# Need to test:
#
# - Mutual exclusivity of certain options (low priority)
Expand Down
1 change: 1 addition & 0 deletions tests/rpm/toolchain_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,6 @@ def _create_toolchain_creation_tests():
expect_path = "/usr/bin/foo",
)

# buildifier: disable=unnamed-macro
def create_toolchain_analysis_tests():
_create_toolchain_creation_tests()
2 changes: 2 additions & 0 deletions tests/tar/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ load("@rules_python//python:defs.bzl", "py_test")
# buildifier: disable=bzl-visibility
load("//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "pkg_mkdirs", "pkg_mklink")
load("//pkg:verify_archive.bzl", "verify_archive_test")

# buildifier: disable=bzl-visibility
load("//pkg/private/tar:tar.bzl", "SUPPORTED_TAR_COMPRESSIONS", "pkg_tar")
load("//tests:my_package_name.bzl", "my_package_naming")
load("//tests/util:defs.bzl", "directory", "fake_artifact", "link_tree")
Expand Down
1 change: 1 addition & 0 deletions toolchains/git/git_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ _find_system_git = repository_rule(
},
)

# buildifier: disable=function-docstring-args
def experimental_find_system_git(name, workspace_file = None, verbose = False):
"""Create a toolchain that lets you run git.
Expand Down
1 change: 1 addition & 0 deletions toolchains/rpm/rpmbuild.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ is_rpmbuild_available = rule(
toolchains = ["@rules_pkg//toolchains/rpm:rpmbuild_toolchain_type"],
)

# buildifier: disable=unnamed-macro
def rpmbuild_register_toolchains():
native.register_toolchains("@rules_pkg//toolchains/rpm:rpmbuild_missing_toolchain")

0 comments on commit e13364c

Please sign in to comment.