oppiliappan/statix

Accept multiple file arguments for formatting

Mic92 opened this issue · 7 comments

Mic92 commented

I use treefmt for formatting large code bases and incorporating multiple linters into one tool.
Treefmt requires that formatters/linters accept multiple arguments.
statix does not support this and hence workarounds are required to make it work: Mic92/dotfiles@1b4d901

In #62 I made an attempt to implement this.

Mic92 commented

I think if users pass files than statix actually does not have to check the gitignore at all since the user already made a choice what to format.

What do you think of this behavior:

  • statix PATH: statix will apply its usual ignoring and traversal operations, users running statix manually would prefer this behavior
  • statix [PATHS ...]: statix will run on every path supplied regardless of ignore options (either from .gitignore or statix.toml), directories will NOT be traversed in this scenario, the caller has to use a glob like statix DIR/**/*.nix. this behavior might be preferred by tools.

Just an idea though, open to suggestions here.

Mic92 commented

What if it only applies gitignore if $PATH is a directory? Otherwise treefmt with one file change will behave differently compared two multiple. Treefmt has an internal cache to apply formatter only to changed files.

yeah, that sounds reasonable to me.

@nerdypepper thanks for maintaining and opensourcing such a great tool!

I want to properly integrate statix with treefmt (see issue), but I found that the best solution would be to report this upstream. As mentioned before by @Mic92 , treefmt needs the formatters to accept multiple file paths after statix fix.

Is there any update on this? I am also willing to help, if I can.

sorry about the inactivity here, @kaikikokuke, i am going to take a good chunk out of this weekend to revisit all of statix in general, i'll try to get some time to do this there.

No worries @nerdypepper. Thanks for the reply and taking your time to improve statix. If there are any good first issues or enhancements, just label them or let me know