Skip to content

Commit

Permalink
[antlir] Lint clean all buck files
Browse files Browse the repository at this point in the history
Test Plan: arc lint --lintall

Reviewed By: dtolnay

Differential Revision: D68186835

fbshipit-source-id: 140816958458b04cd7cc17771ccee3d671464819
  • Loading branch information
zertosh authored and facebook-github-bot committed Jan 15, 2025
1 parent 84e72ab commit 23d15df
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 18 deletions.
1 change: 0 additions & 1 deletion antlir/antlir2/bzl/anon_helpers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def _new_rule(*, impl, attrs, artifact_promise_mappings = None):
for outer, inner in default_outer_attr_names.items()
}

# @lint-ignore BUCKRESTRICTEDSYNTAX
def _anon_target(ctx: AnalysisContext, **kwargs):
for outer, inner in default_outer_attr_names.items():
if not hasattr(ctx.attrs, outer):
Expand Down
5 changes: 5 additions & 0 deletions antlir/antlir2/bzl/package/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ _cpio_zst = _new_compressed_package_rule(
compressor = "zstd",
)

# @unused
_rpm, _rpm_anon = _new_package_rule(
rule_attrs = {
"arch": attrs.enum(
Expand Down Expand Up @@ -334,6 +335,7 @@ _rpm, _rpm_anon = _new_package_rule(
uses_build_appliance = True,
)

# @unused
_vfat, _vfat_anon = _new_package_rule(
rule_attrs = {
"fat_size": attrs.option(attrs.int(), default = None),
Expand Down Expand Up @@ -377,6 +379,7 @@ tar_zst_rule = _new_compressed_package_rule(
compressor = "zstd",
)

# @unused
_ext3, _ext3_anon = _new_package_rule(
format = "ext3",
rule_attrs = {
Expand All @@ -396,12 +399,14 @@ _ext3, _ext3_anon = _new_package_rule(
uses_build_appliance = True,
)

# @unused
_unprivileged_dir, _unprivileged_dir_anon = _new_package_rule(
format = "unprivileged_dir",
is_dir = True,
sudo = True,
)

# @unused
_erofs, _erofs_anon = _new_package_rule(
format = "erofs",
sudo = True,
Expand Down
1 change: 1 addition & 0 deletions antlir/antlir2/bzl/tests/anon_helpers/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ load("//antlir/antlir2/bzl:anon_helpers.bzl", "anon_helpers")
def _anon_impl(ctx):
return [DefaultInfo(ctx.actions.write_json("out.json", ctx.attrs))]

# @unused
_anon, _anon_rule = anon_helpers.new_rule(
impl = _anon_impl,
attrs = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

load("//antlir/antlir2/bzl:platform.bzl", "rule_with_default_target_platform")

def _transition_impl(platform: PlatformInfo, refs: struct) -> PlatformInfo:
def _transition_impl(
platform: PlatformInfo,
refs: struct) -> PlatformInfo: # @unused
constraints = platform.configuration.constraints

constraints = {
Expand Down
1 change: 1 addition & 0 deletions antlir/antlir2/features/rpm/tests/sig/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ image.layer(
# implemented, we can't write a proper test for it so just have to test manually
# by passing `-c antlir2.rpm_sig_broken_images=1` and verifying that the build
# fails.
# buildifier: disable=no-effect
[
image.layer(
name = "install-signed-with-wrong-key",
Expand Down
3 changes: 2 additions & 1 deletion antlir/antlir2/os/package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def set_default_os_for_package(*, default_os: str):
def get_default_os_for_package() -> str:
return read_package_value(_DEFAULT_OS_KEY) or "centos9"

def all_images_in_package_use_default_os(yes: bool = True):
def all_images_in_package_use_default_os(
yes: bool = True): # @unused
# Must still exist until the `redundant_default_os` codemod is complete and
# removed all callsites
pass
1 change: 1 addition & 0 deletions antlir/antlir2/package_managers/dnf/rules/makerepo/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rust_binary(
],
)

# buildifier: disable=no-effect
buck_sh_binary(
name = "makerepo",
main = "fbcode//antlir/antlir2/package_managers/dnf/rules/makerepo/facebook/msdk:makerepo",
Expand Down
7 changes: 3 additions & 4 deletions antlir/bzl/build_defs_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

# @lint-ignore-every BUCKLINT

def _third_party_library(project, rule = None, platform = None):
"""
In FB land we want to find the correct build for a third-party target
Expand Down Expand Up @@ -147,7 +145,6 @@ def _invert_dict(x):
return x
return {v: k for k, v in x.items()}

# @lint-ignore BUCKRESTRICTEDSYNTAX
def _python_library(**kwargs):
kwargs["srcs"] = _invert_dict(kwargs.pop("srcs", []))
kwargs["resources"] = _invert_dict(kwargs.pop("resources", []))
Expand Down Expand Up @@ -231,11 +228,13 @@ def _rust_bindgen_library(name: str, header: str, **kwargs):
visibility = kwargs.pop("visibility", []),
)

def _rust_python_extension(name: str, **kwargs):
def _rust_python_extension(name: str, **_kwargs):
native.alias(
name = name,
actual = "antlir//antlir:empty",
)

# buildifier: disable=print
print("TODO: rust_python_extension")

def _write_file(*args, **kwargs):
Expand Down
1 change: 0 additions & 1 deletion antlir/bzl/flatten.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def _flatten_any(lst):
def _typed_flattener(item_type) -> types.function:
types.lint_noop(item_type)

# @lint-ignore BUCKLINT
t = native.eval_type(list[item_type])

def _flatten(lst):
Expand Down
4 changes: 2 additions & 2 deletions antlir/bzl/oss_shim.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
# This bzl file is provided to make split internal/oss loads a little easier
#

def ret_none(*args, **kwargs):
def ret_none(*_args, **_kwargs):
return None

def ret_empty_list(*args, **kwargs):
def ret_empty_list(*_args, **_kwargs):
return []

empty_dict = {}
Expand Down
2 changes: 0 additions & 2 deletions antlir/bzl/sha256.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ def hex_to_base64(x):

# The return value has 6 bits per byte, except the last byte has 4 bits.
def sha256_b64(s):
# @lint-ignore BUCKLINT
return hex_to_base64(native.sha256(s))

def sha256_hex(s):
# @lint-ignore BUCKLINT
return native.sha256(s)
2 changes: 0 additions & 2 deletions antlir/bzl/target_helpers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ def normalize_target(target):
# The repository name always starts with "@", which we do not want here.
# default_repo will be empty for the main repository, which matches the
# results from $(query_targets ...).
# @lint-ignore BUCKLINT
default_repo = repository_name()[1:],
# @lint-ignore BUCKLINT
default_base_path = native.package_name(),
)
return target_utils.to_label(
Expand Down
3 changes: 0 additions & 3 deletions antlir/bzl/types.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ Shim for type hints in buck. A lot of this can be deleted when we move to buck2
entirely, but for now this is required to keep buck1 code evaluating.
"""

# We use recursion and `native.` so ignore those lints
# @lint-ignore-every BUCKLINT

load("@prelude//utils:type_defs.bzl", prelude_types = "type_utils")
load(":structs.bzl", "structs")

Expand Down
2 changes: 2 additions & 0 deletions third-party/kernel/kernels.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
def _get(kernel_or_alias, arch = "x86_64"):
# buildifier: disable=print
print("TODO: kernels.get({}, {})".format(kernel_or_alias, arch))

def _selection(name, query, oncall):
# buildifier: disable=print
print("TODO: kernels.selection({}, {}, {})".format(name, query, oncall))

kernels = struct(
Expand Down
1 change: 0 additions & 1 deletion third-party/rust/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def buildscript_run(
# We could patch reindeer to generate this correctly since it seems to
# know where crate roots actually exist under the repo, but I'm just
# going to assume that it's directly in the root of the repo.
# @lint-ignore BUCKLINT
native.genrule(
name = filegroup_name,
out = ".",
Expand Down

0 comments on commit 23d15df

Please sign in to comment.