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

Permit configuration extensions #484

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexeagle
Copy link
Member

@alexeagle alexeagle commented Feb 14, 2025

Created from a commit by @b0inbot :

An example which allows configuring internal details of the formatter. Replaces the switch statement in format.sh with a JSON that is handled. (dont love depending on jq here).

Obviously a lot more is needed for this to be accepted: doc work, porting over mirror_linguist_languages.sh, a format_config or format_extensions function within defs.bzl.

Testing was done by running bazel run format_custom within the test folder and seeing the .bozo file getting processed by the mock yaml formatter.

penne[130][test] $ pwd
/home/boin/Projects/tools/tools/rules_lint/format/test
penne[000][test] $ bazel run format_custom
INFO: Analyzed target //format/test:format_custom (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //format/test:format_custom up-to-date:
  bazel-bin/format/test/format_custom.bash
INFO: Elapsed time: 0.093s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/format/test/format_custom.bash
+ yamlfmt example/hello.bozo
Formatted YAML in 0m0.022s

An example which allows configuring internal details of the
formatter. Replaces the switch statement in format.sh with
a JSON that is handled. (dont love depending on jq here).

Obviously a lot more is needed for this to be accepted: doc work,
porting over mirror_linguist_languages.sh, a format_config or
format_extensions function within defs.bzl.

Testing was done by running bazel run format_custom within
the test folder and seeing the .bozo file getting processed by the
mock yaml formatter.

```
penne[130][test] $ pwd
/home/boin/Projects/tools/tools/rules_lint/format/test
penne[000][test] $ bazel run format_custom
INFO: Analyzed target //format/test:format_custom (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //format/test:format_custom up-to-date:
  bazel-bin/format/test/format_custom.bash
INFO: Elapsed time: 0.093s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/format/test/format_custom.bash
+ yamlfmt example/hello.bozo
Formatted YAML in 0m0.022s
```
@alexeagle alexeagle marked this pull request as draft February 14, 2025 23:03
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