> I've run across too many people that have `mix format` as part of their
editor workflow. PRs that include massive reformats. It doesn't happen
often but it happens.

I was skeptical but this argument convinced me that we should consider such
an opt-out option in .formatter.exs.

Forking a repo, starting to work on a fix, realizing they are not using the
formatter and that parts now have changed, tweaking the workspace settings
to disable the formatter for this project, reverting the formatter
changes...
This is all unnecessary friction that could indeed be avoided by having the
settings file stating in the first place: "hey, this project doesn't use
the formatter, please don't format the files".

My only concern is that I wish the formatter was more widely used, and
adding this feature might send a signal in the opposite direction.

Le dim. 21 juil. 2024 à 22:57, Brian Cardarella <bcardare...@gmail.com> a
écrit :

> I've run across too many people that have `mix format` as part of their
> editor workflow. PRs that include massive reformats. It doesn't happen
> often but it happens.
>
> - Brian
>
>
> On Sun, Jul 21, 2024 at 9:55 AM José Valim <jose.va...@dashbit.co> wrote:
>
>> The formatter is opt-in. Elixir does not call "mix format" for you.
>>
>> On Sun, Jul 21, 2024 at 10:50 AM Brian Cardarella <bcardare...@gmail.com>
>> wrote:
>>
>>> You're correct that I'm probably coming at this from the wrong end. In
>>> lieu of not getting Sourceror to accept opting out of the formatter I was
>>> searching for ways to avoid the formatter from doing anything.
>>>
>>> As an aside, I realize the ship has sailed on this but I do wish the
>>> formatter was opt-in by design. Iteratively build your formatting
>>> preferences rather than default being anything at all. A single LOC to have
>>> the current settings, but still opt-in
>>>
>>> - Brian
>>>
>>>
>>> On Sun, Jul 21, 2024 at 9:45 AM José Valim <jose.va...@dashbit.co>
>>> wrote:
>>>
>>>> I think there is some confusion happening here.
>>>>
>>>> 1. I don't see a reason to allow mix format to be a no-op? If you don't
>>>> want to run the formatter, you can simply not run "mix format".
>>>>
>>>> 2. On the other hand, I don't think turning off the formatter will
>>>> address Sourceror. I believe it uses the formatting APIs to stitch the code
>>>> back together, regardless of mix format.
>>>>
>>>> In other words, I don't think the issue you have is mix format. It is
>>>> with whatever tool that is invoking it.
>>>>
>>>> On Sun, Jul 21, 2024 at 10:41 AM Brian Cardarella <
>>>> bcardare...@gmail.com> wrote:
>>>>
>>>>> Yes, I know that Sourceror has `patch_string` but that doesn't solve
>>>>> all the problems I'm tackling.
>>>>>
>>>>> On Sunday, July 21, 2024 at 9:40:42 AM UTC-4 Brian Cardarella wrote:
>>>>>
>>>>>> I get that this would work but that feels hacky to me. Would you
>>>>>> accept a PR to provides an opt-out option? Also, why does `mix format`
>>>>>> format anything at all if `.formatter` isn't defined? I would have 
>>>>>> expected
>>>>>> that to be no-op.
>>>>>>
>>>>>> My use cases:
>>>>>>
>>>>>> 1. I don't like auto-formatters. We don't need to debate the merits
>>>>>> of this, just my preference
>>>>>> 2. Sourceror forces everything through the formatter. When converting
>>>>>> quoted back to strings despite all of the indentation information being
>>>>>> included in the AST nodes the formatter is still run. I'd much prefer if
>>>>>> the project itself opts out of the formatter that this doesn't happen and
>>>>>> re-format entire files on someone.
>>>>>>
>>>>>> On Sunday, July 21, 2024 at 9:36:27 AM UTC-4 José Valim wrote:
>>>>>>
>>>>>>> You can probably change its inputs in .formatter.exs to point to a
>>>>>>> directory that does not exist.
>>>>>>>
>>>>>>> On Sun, Jul 21, 2024 at 10:34 AM Brian Cardarella <
>>>>>>> bcard...@gmail.com> wrote:
>>>>>>>
>>>>>>>> I don't see it in the docs, is there a way to turn off formatting
>>>>>>>> entirely so if `mix format` is run it just turns into a no-op?
>>>>>>>>
>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "elixir-lang-core" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to elixir-lang-co...@googlegroups.com.
>>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/elixir-lang-core/7ebc1f83-666a-4f5c-b9c5-f9fd04224d3bn%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/elixir-lang-core/7ebc1f83-666a-4f5c-b9c5-f9fd04224d3bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "elixir-lang-core" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to elixir-lang-core+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/elixir-lang-core/0004d4c0-5aa1-4e68-ae35-9d1f54e30343n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/elixir-lang-core/0004d4c0-5aa1-4e68-ae35-9d1f54e30343n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "elixir-lang-core" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/elixir-lang-core/SYdxYLcsirM/unsubscribe
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> elixir-lang-core+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4K1JvbNyobyp2mJ3v%2BEgzn4pPriRQHg5ZzQ%2Bfwde32yJw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4K1JvbNyobyp2mJ3v%2BEgzn4pPriRQHg5ZzQ%2Bfwde32yJw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "elixir-lang-core" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to elixir-lang-core+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/elixir-lang-core/CADtMk1gc4gLpWWsXowJBzNp_t45%2Bx0NeLNQ5_U1AYGKexd5%3DUw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/elixir-lang-core/CADtMk1gc4gLpWWsXowJBzNp_t45%2Bx0NeLNQ5_U1AYGKexd5%3DUw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "elixir-lang-core" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/elixir-lang-core/SYdxYLcsirM/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> elixir-lang-core+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4Jnf_gOjX%2BPFvOiW-sS10dHSafg2e20-HXyTQrubjy%3DwA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4Jnf_gOjX%2BPFvOiW-sS10dHSafg2e20-HXyTQrubjy%3DwA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/CADtMk1hBx267rYk45NSi7PLTEzBR39uxNrYQm0xM8c1qXzJUOA%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CADtMk1hBx267rYk45NSi7PLTEzBR39uxNrYQm0xM8c1qXzJUOA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CANnyohZTzp3bW2BwngBhoDx801vfCf-X_cpxSPLep8W5d_6XqQ%40mail.gmail.com.

Reply via email to