Skip to content

Add ShortenAbsoluteLabelsToRelative configuration option#3492

Open
hartblanc wants to merge 2 commits intothought-machine:masterfrom
hartblanc:fix/shorten-labels
Open

Add ShortenAbsoluteLabelsToRelative configuration option#3492
hartblanc wants to merge 2 commits intothought-machine:masterfrom
hartblanc:fix/shorten-labels

Conversation

@hartblanc
Copy link

@hartblanc hartblanc commented Feb 27, 2026

This change ensures that absolute labels to package-local targets (e.g. //a/b/c:d) are transformed into local labels (e.g. :d) by the please format command when the new Format.ShortenAbsoluteLabelsToRelative config option is enabled.

The aim of this change is to address #3471.

This change supercedes please-build/buildtools#10.

@hartblanc
Copy link
Author

hartblanc commented Mar 2, 2026

After pondering about please-build/puku#147, I'm actually wondering if we want to make plz format or buildtools/build configurable (as this change does).

The approach of gofmt for example, is to not allow any configuration and 'Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.'. This works very nicely for tools which modify go source code, as they are able to always produce well-formatted output by simply calling gofmt (as a library).

For this reason, whilst it seems a little crude at first, I'm wondering if please-build/buildtools#10 might actually be preferable to this approach.

Copy link
Contributor

@toastwaffle toastwaffle left a comment

Choose a reason for hiding this comment

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

Please could you fix the lint (otherwise this is good to go)

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