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

add a check or diff mode to bazel mod tidy #24263

Open
voxeljorge opened this issue Nov 10, 2024 · 3 comments
Open

add a check or diff mode to bazel mod tidy #24263

voxeljorge opened this issue Nov 10, 2024 · 3 comments
Labels
help wanted Someone outside the Bazel team could own this P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request

Comments

@voxeljorge
Copy link

voxeljorge commented Nov 10, 2024

Description of the feature request:

The bazel mod tidy tool is very useful for keeping MODULE.bazel up to date, but it does require developers to be disciplined enough to remember to run this or some kind of hook to make sure changes get checked in. A common pattern for ensuring files like this are up to date is to use a check or diff mode which prints changes it would make and exits with an error status code. Gazelle for example has gazelle -mode diff which makes no changes on disk and prints them as a diff instead.

A similar feature for bazel mod tidy would be very useful (especially since one common use is to run it right after gazelle).

Which category does this issue belong to?

bzlmod

What underlying problem are you trying to solve with this feature?

We would like to add a CI check that fails if MODULE.bazel has not been updated with bazel mod tidy correctly.

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

release 7.4.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

I've tried to look through bazel issues and the docs for bazel mod tidy and don't see anything like this.

Any other information, logs, or outputs that you want to share?

No response

@aaomidi
Copy link

aaomidi commented Nov 10, 2024

Buildozer does have the -stdout flag, which can be used to create a --validate option.

@sgowroji sgowroji added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Nov 11, 2024
@meteorcloudy meteorcloudy added P2 We'll consider working on this in future. (Assignee optional) help wanted Someone outside the Bazel team could own this and removed untriaged labels Nov 12, 2024
@meteorcloudy
Copy link
Member

/cc @fmeum

@fmeum
Copy link
Collaborator

fmeum commented Nov 12, 2024

This seems useful and shouldn't be too hard based on what @aaomidi wrote above. This could be a good candidate for an external contribution, happy to help anyone who wants to pick this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Someone outside the Bazel team could own this P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request
Projects
None yet
Development

No branches or pull requests

7 participants