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

Starlark Formatting #581

Open
Xophmeister opened this issue Jul 14, 2023 · 2 comments
Open

Starlark Formatting #581

Xophmeister opened this issue Jul 14, 2023 · 2 comments
Labels
epic: language-support Relates to the number of languages Topiary supports and how well they are supported P4 unimportant: consider wontfix or other priority type: feature request

Comments

@Xophmeister
Copy link
Member

Is your feature request related to a problem? Please describe.
We're often on the look-out for new languages to add support for, in Topiary. Starlark may be worth looking into, given our connection with the Scalable Builds Group.

Describe the solution you'd like
Starlark formatting support in Topiary.

Describe alternatives you've considered
I didn't immediately find any extant Starlark formatters (to be fair, I didn't look very hard). As Starlark is (IIRC) a subset of Python, it may be possible to format it with Python formatters, such as Black; I don't know if this is the usual approach. (@aherrmann Do you know the formatting story for Starlark?)

(If, e.g., Black is a viable formatter for Starlark, then that would deprioritise this issue.)

Additional context
There are at least two Tree Sitter grammars for Starlark:

If we're going to support Python in the future, then supporting Starlark may be a good intermediary step.

(It's a big "if", which also applies to Starlark: It's not 100% clear that Topiary will work well with semantic-whitespace languages.)

@ErinvanderVeen
Copy link
Contributor

I think the industry standard is Buildifier

@aherrmann
Copy link
Member

As @ErinvanderVeen points out Buildifier is the standard formatter used for Bazel Starlark files. Next to formatting it also provides linting. For those who like pre-commit checks, there is also an integration.
There is also Meta's Starlark-Rust which includes linting capabilities and a language server and VSCode extension.

@Xophmeister Xophmeister added the P4 unimportant: consider wontfix or other priority label Jul 14, 2023
@ErinvanderVeen ErinvanderVeen added the epic: language-support Relates to the number of languages Topiary supports and how well they are supported label Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic: language-support Relates to the number of languages Topiary supports and how well they are supported P4 unimportant: consider wontfix or other priority type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants