macisamuele / language-formatters-pre-commit-hooks

Collection of custom pre-commit hooks.
Apache License 2.0
112 stars 56 forks source link

toml --spaces-indent-inline-array support #185

Closed brodybits closed 9 months ago

brodybits commented 9 months ago

I think an "--spaces-indent-inline-array" option similar to the --spaces-indent-inline-array option in toml-sort would be helpful.

My workaround is to simply call toml-sort CLI command with this option.

(I may still use this toolset for the pretty-format-ini command.)

I may raise a PR for this, time permitting.

macisamuele commented 9 months ago

Feel free to open a PR and please add an end to end test such that the effect of the flags are clear. No objections on the future per se 😅

alkatar21 commented 9 months ago

Does not that already exist (--indent)? https://github.com/macisamuele/language-formatters-pre-commit-hooks/blob/f118bd857350e89a76faa4cc5092e9d53dbe3677/language_formatters_pre_commit_hooks/pretty_format_toml.py#L23-L28 https://github.com/macisamuele/language-formatters-pre-commit-hooks/blob/f118bd857350e89a76faa4cc5092e9d53dbe3677/language_formatters_pre_commit_hooks/pretty_format_toml.py#L62

I was about to create an issue for spaces_before_inline_comment when I saw this, or is this what is meant? https://github.com/macisamuele/language-formatters-pre-commit-hooks/blob/f118bd857350e89a76faa4cc5092e9d53dbe3677/language_formatters_pre_commit_hooks/pretty_format_toml.py#L61

macisamuele commented 9 months ago

@alkatar21 thanks for the check (did not had effective time to open the code). The requested feature seems to be already supported via --indent argument. Going to close this issue for now. If you feel that having customisation on the comment flag as well feel free to open a PR with it and I will be looking into it.

A general rule of thumb, the library aims to reduce bikeshedding on formatting options. For this reason I have the usual tendency of not adding too many configurations as they usually lead to more discussions on "style" wrt actual content of the changes. Still, if we see a reason for adding it I would be fine.