Skip to content

[buildifier]: add lint warning for disallowed load #1231

@alexeagle

Description

@alexeagle

Many ruleset users wrap the upstream rules with a macro that sets defaults, enforces policies, or creates an additional rule.

Gazelle can generate rules with a load statement that ensures the macro is used rather than directly loading the external rule, using the map_kind directive.

However, these users still need a way to prevent their developers accidentally loading symbols from a starlark module they forbid.

For example I'd want to configure buildifier to detect

load("@rules_python//python:defs.bzl", "py_library")

and print the suggestion of using a macro instead like

load("//tools/bazel/python:defs.bzl", "py_library")

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions