oppiliappan / statix

lints and suggestions for the nix programming language
https://git.peppe.rs/languages/statix/about
MIT License
545 stars 21 forks source link

Accept multiple file arguments for formatting #69

Open Mic92 opened 1 year ago

Mic92 commented 1 year ago

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: https://github.com/Mic92/dotfiles/commit/1b4d901a9e88de101862f3009c3b9e635820f2b3

In https://github.com/nerdypepper/statix/pull/62 I made an attempt to implement this.

Mic92 commented 1 year ago

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.

oppiliappan commented 1 year ago

What do you think of this behavior:

Just an idea though, open to suggestions here.

Mic92 commented 1 year ago

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.

oppiliappan commented 1 year ago

yeah, that sounds reasonable to me.

kaikikokuke commented 1 year ago

@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.

oppiliappan commented 1 year ago

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.

kaikikokuke commented 1 year ago

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