bazel-contrib / bazel-contrib/buildtools
[buildifier] Add checker to detect `default_visiblity` set to public
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 471
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 13
Description
It is considered a good practice to not set `default_visibility` to public.
That is documented in https://bazel.build/versions/9.1.0/concepts/visibility
> Best practice: Avoid setting default_visibility to public. It may be convenient for prototyping or in small codebases, but the risk of inadvertently creating public targets increases as the codebase grows. It's better to be explicit about which targets are part of a package's public interface.
It would be great if buildifier would provide a checker for it.
Contributor guide
Research direction
Locate buildifier's existing checker implementations and their tests, then trace how BUILD-file visibility attributes are parsed and validated. Add coverage for a public default_visibility value and confirm that the checker reports it while allowing non-public values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100