Disable bzl-visibility lint if the target file has a `visibility()` declaration (#1439)

* Disable bzl-visibility lint if the target file has a `visibility()` declaration.

The official docs for this lint say:

> This lint predates the load visibility feature and is unnecessary in workspaces where .bzl files declare visibilities.

However the lint can sometimes get in the way, by warning about instances where the usage is actually intended.

Since `visibility()` is more explicit, and more strictly enforced, there is no need for the lint to return any warnings if the target file has a visibility declaration.

MARKDOWN=true

* Addressed edge case where call function is not an ident.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Added a test that files without visibility() still enforce the check.

MARKDOWN=true

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
3 files changed
tree: 724f980db6bcc3cfcac8aa2bd4c64b9464172d4e
  1. .bazelci/
  2. .github/
  3. api_proto/
  4. build/
  5. build_proto/
  6. buildifier/
  7. buildozer/
  8. bzlenv/
  9. config/
  10. convertast/
  11. deps_proto/
  12. differ/
  13. edit/
  14. extra_actions_base_proto/
  15. file/
  16. generatetables/
  17. labels/
  18. lang/
  19. release/
  20. tables/
  21. testutils/
  22. unused_deps/
  23. warn/
  24. wspace/
  25. .bazelrc
  26. .bazelversion
  27. .gitignore
  28. .mailmap
  29. .pre-commit-config.yaml
  30. BUILD.bazel
  31. CODEOWNERS
  32. CONTRIBUTING.md
  33. CONTRIBUTORS
  34. go.mod
  35. go.sum
  36. launcher.js
  37. LICENSE
  38. MODULE.bazel
  39. README.md
  40. status.py
  41. update_generated.sh
  42. WARNINGS.md
  43. WORKSPACE
  44. WORKSPACE.bzlmod
README.md

Buildtools for bazel

This repository contains developer tools for working with Google's bazel buildtool.

Build status

Setup

See instructions in each tool's directory.