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

Need configurability #172

Closed
evansorenson opened this issue May 29, 2024 · 2 comments
Closed

Need configurability #172

evansorenson opened this issue May 29, 2024 · 2 comments

Comments

@evansorenson
Copy link

Hi,

I work at a company with a very large Elixir repo and it isn't feasible to A) apply all styles at once or B) to apply to all files at once. Therefore, I would like to make the styles configurable (turning on/off) and potentially a file whitelist/blacklist (passed on paths).

It seems in the past you have been against adding configurability. Are you open to reconsidering your stance? I believe configurability would make the library much easier to adopt.

@evansorenson
Copy link
Author

evansorenson commented May 29, 2024

Also, just wanted to say this plugin is fantastic :) I use it for all my side projects

@novaugust
Copy link
Contributor

Cheers Evan =) appreciate the kind words. i feel your pain on shipping to a large project, as i experienced that when i created styler! (or when i'm trying out scary new things like the mix config sorting in the 1.0 releases)

adding configuration for on/off isn't feasible for me from a maintainability viewpoint - i go into it here. as saveman says in that PR, there's lots of forks out there where folks have set up some sort of on/off configuration. in fact, that's what almost all the forks are for as far as i've seen :) you could easily copy what they're doing if you only want some style rewrites.

but! as i was saying, i've experienced what you're talking about on our internal project, so here's how i get new (potentially dangerous) styler features in on an existing codebase where you're unable to just do it all in one fell swoop

the idea is, piecemeal modify file-by-file, or group-of-files at a time, for ease of review. to accomplish that:

  1. add styler to your mix.exs as normal
  2. likewise, add it to your plugins
  3. format only the files you want to ship in a single reviewable PR: mix format lib/file1.ex lib/file2.ex lib/all_files_in_this_folder
  4. commit only those files and ship it
  5. rinse and repeat

you could also commit the changes to mix.exs and .formatter.exs, and just comment out the plugins: [Styler] line until you're ready to turn it on for good

now all that said, if you're on 1.0.0-rc.0, the only potential shippable-breakage styler will introduce is in config sorting, and that only if your config had a hidden duplicate configuration. there's also this one about alias lifting but the compiler will tell you if that happens, so no stress on reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants