Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a user extensible compliance linter #92

Open
aiuto opened this issue Apr 28, 2023 · 2 comments
Open

Provide a user extensible compliance linter #92

aiuto opened this issue Apr 28, 2023 · 2 comments
Labels
enhancement New feature or request P3

Comments

@aiuto
Copy link
Collaborator

aiuto commented Apr 28, 2023

Typically, every BUILD file in a bazel module is under the license defined at //:license. Since Bazel does not have inheritance from enclosing packages, we must usually add:

package(default_package_metadata=["//:license", "//:package_info"])

to every BUILD file. We should provide tools to help user maintain that invariant.

Initial thoughts:

  • Must be user extensible so organizations can add their own policies.
  • Standalone tool:
    • pro: can find all files, even if they are not in a package. That is a big win if you want to inject license scanning at this point.
    • con: can't be a bazel test.
  • Bazel rule
    • pro: Can be a test, so it is trivial to add to CI.
    • con: Misses files which are not mentioned from a BUILD file.

@jin

@aiuto aiuto added the enhancement New feature or request label Apr 28, 2023
@fmeum
Copy link
Contributor

fmeum commented Apr 28, 2023

@Wyverald's REPO.bazel proposal may solve this.

@jin
Copy link
Member

jin commented May 2, 2023

Android (AOSP) has a virtual monorepo structure like this:

% tree
.
├── external
│   ├── a
│   │   ├── BUILD
│   │   ├── LICENSE
│   │   ├── METADATA
│   │   └── sub
│   │       └── BUILD
│   └── b
│       ├── BUILD
│       ├── LICENSE
│       └── METADATA
└── foo
    └── BUILD

where //external/a and //external/b are git projects. They're also not necessarily repos like @a and @b, but //external/a and //external/b packages.

I think this shouldn't to be a bazel test. It could be like a buildifier-type standalone linter/static analyzer that fails loudly if some BUILD file doesn't have default_package_metadata set.

@aiuto aiuto added the P3 label Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P3
Projects
None yet
Development

No branches or pull requests

3 participants