Skip to content

Do not report misplaced-load lint in WORKSPACE files#186

Open
abhinavgautam01 wants to merge 1 commit intofacebook:mainfrom
abhinavgautam01:fix/workspace-load-lint
Open

Do not report misplaced-load lint in WORKSPACE files#186
abhinavgautam01 wants to merge 1 commit intofacebook:mainfrom
abhinavgautam01:fix/workspace-load-lint

Conversation

@abhinavgautam01
Copy link
Copy Markdown

Fixes #145.

Summary

This PR fixes a false-positive lint warning in Bazel workspace files.

misplaced-load currently warns when a load(...) is not at the top of a file.
That behavior is useful for normal Starlark files, but it is noisy for WORKSPACE / WORKSPACE.bazel, where repository setup calls may legitimately appear before
load(...).

Changes

  • Skip FlowIssue::MisplacedLoad for files named:
  • WORKSPACE
  • WORKSPACE.bazel
  • Keep existing misplaced-load behavior unchanged for all other files.
  • Add focused tests in starlark/src/analysis/flow.rs:
  • test_lint_misplaced_load_workspace
  • test_lint_misplaced_load_workspace_bazel

Validation

  • cargo test -p starlark test_lint_misplaced_load --lib
  • cargo clippy
  • cargo build
  • cargo test
  • cargo bench

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 2, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 2, 2026

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D103520777. (Because this pull request was imported automatically, there will not be any future comments.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LSP: load statement not at the top of WORKSPACE file

1 participant