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 new fmt plugins for build file formatting #16560

Merged
merged 17 commits into from
Aug 22, 2022

Conversation

thejcannon
Copy link
Member

Piggybacking off the previous changes, this PR adds two new plugins at pants.backend.build_files.fmt (black and yapf) which format BUILD files in fmt (and verify in lint).

Additional plumbing has been made to re-use the same codepaths in all of update-build-files, fmt on BUILD, and fmt for Python targets.

Commits useful in order.

[ci skip-rust]
[ci skip-build-wheels]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Amazing!! Thoughts on what testing strategy would make sense? We already test Black extensively in black/rules_integration_test.py, and we have the same tests in update_build_files_test.py.

Maybe we add one simple RuleRunner test for the new backends? Only to make sure the wiring is correct etc. Or even copy over the update-build-files tests?

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Nice! Thanks! Let's get approval from at least one other person on the backend names? They make sense to me.

docs/markdown/Releases/upgrade-tips.md Outdated Show resolved Hide resolved
docs/markdown/Using Pants/concepts/targets.md Outdated Show resolved Hide resolved
pants.toml Show resolved Hide resolved
@thejcannon
Copy link
Member Author

Let's get approval from at least one other person on the backend names? They make sense to me.

WOuld @stuhood 's approval of #16573 suffice?

@Eric-Arellano
Copy link
Contributor

WOuld @stuhood 's approval of #16573 suffice?

Yeah, sg. It's a very reasonable backend name.

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]
thejcannon and others added 4 commits August 22, 2022 12:04
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@thejcannon thejcannon merged commit dfe1d5b into pantsbuild:main Aug 22, 2022
@thejcannon thejcannon deleted the fmtbuildplugins branch August 22, 2022 19:43
cczona pushed a commit to cczona/pants that referenced this pull request Sep 1, 2022
Piggybacking off the previous changes, this PR adds two new plugins at `pants.backend.build_files.fmt` (`black` and `yapf`) which format BUILD files in `fmt` (and verify in `lint`).

Additional plumbing has been made to re-use the same codepaths in all of `update-build-files`, `fmt` on BUILD, and `fmt` for Python targets.

Commits useful in order.

[ci skip-rust]
[ci skip-build-wheels]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants