-
Notifications
You must be signed in to change notification settings - Fork 96
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
standardize program options with mkFormatterModule #288
Conversation
A common complaint / observation is that treefmt-nix config tend to be a mix between enabled programs, and treefmt settings to override includes/excludes/priority. Some programs have those options available directly, but not all of them. In order to fix that, this commit introduces `mkFormatterModule`, a function that generates a regular module structure based on a few parameters. And that support the includes / excludes / priority out of the box.
183cfdd
to
0ab12ff
Compare
Ok this is ready. I was able to convert all the formatters except mypy that does some funky stuff. Looking for feedback from all the maintainers since this changes all the modules. /cc @anntnzrb @sebaszv @haruki7049 @gabyx @SigmaSquadron @adam-gaia @RossSmyth @JakobLichterfeld |
0ab12ff
to
8030839
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Seems to work, much less boilerplate code but same features and a cleaner interface.
Just curious if you did use any tooling for the module changes or did that all "by hand"?
This was something I did pick up on as being an annoyance. Glad this is standardised now. LGTM 👍 |
Sorry for missing this. Looks superb; it makes a lot of sense to abstract all of the simpler module definitions. Thanks! |
✔️ Great refactor, contributions should be even easier now. |
These two commits broke the flake-parts module. |
Bug reports are more useful if they contain info on what breaks and how that breakage might be reproducible. :) It seems to be broken indeed, runs into infinite recursion while evaluating the module arg
Can be reproduced by i.e. |
Missing Line 35 in 3b0afa7
Alternatively, you could perhaps go through the main entrypoint and get the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring, checked the dart-format
part. lgtm beside of the flake-parts
issue, see #288 (comment)
@zimbatm : Right this change does not change user facing treefmt.nix code? |
@zimbatm : great improvement. |
A common complaint / observation is that treefmt-nix config tend to be a mix between enabled programs, and treefmt settings to override includes/excludes/priority. Some programs have those options available directly, but not all of them.
In order to fix that, this commit introduces
mkFormatterModule
, a function that generates a regular module structure based on a few parameters. And that support the includes / excludes / priority out of the box.A few of the programs are already converted to that format. Ideally all of them are getting converted soon.