Skip to content

Delete unused variables and arguments#530

Closed
keith wants to merge 2 commits into
bazelbuild:mainfrom
keith:ks/delete-unused-variables-and-arguments
Closed

Delete unused variables and arguments#530
keith wants to merge 2 commits into
bazelbuild:mainfrom
keith:ks/delete-unused-variables-and-arguments

Conversation

@keith

@keith keith commented Jun 26, 2026

Copy link
Copy Markdown
Member

No description provided.

@keith

keith commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

this is the most aggressive version of this cleanup, maybe some of these are used in google3 only code? in which case i can revert those individually, or just close this and go with #529 which just marks them as @unused instead

@keith keith mentioned this pull request Jun 26, 2026
@keith keith force-pushed the ks/delete-unused-variables-and-arguments branch from 7969f75 to c09781c Compare July 2, 2026 22:14

@ted-xie ted-xie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM. I need to run some more tests internally to see if this breaks anything in unexpected ways.

Comment thread rules/min_sdk_version.bzl

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: load order cannot be changed here, since the internal name for bazel_skylib is sorted after the internal name for //rules:visibility.bzl.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, any idea how other places are solving this? i don't think i've ever seen an opt out for this google case and I have to imagine it was hit in other places too

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One example is rules_java: They run buildifier during the export process.

We may consider that path in the future, but not yet. Running a formatter is a non-reversible change, which makes tracing code export issues more complicated. For various reasons, rules_android's export is already super complicated, and I want to keep things simple for now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed reverting this one but I assume there are others that hit this too?

quick check that you do set PROJECT_VISIBILITY to something else internally right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There have been various PRs in the past where I've manually undone load order changes.

PROJECT_VISIBILITY is called the same thing internally. It's a list that's loaded from rules/visibility.bzl. The contents of the list differ internally vs externally.

@copybara-service copybara-service Bot closed this in 2975c3b Jul 7, 2026
@keith keith deleted the ks/delete-unused-variables-and-arguments branch July 7, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants