Many thanks for the responses guys! Makes total sense :)

On Friday, 18 March 2022 at 16:41:52 UTC [email protected] wrote:

> Hey Tim, thanks for the proposal.
>
> As Wojtek mentioned, a strict goal of "mix format" is to never change the 
> AST. This means that, in principle, we should not reorder statements.
>
> In this particular case though, we have a much bigger issue: these 
> statements might depend on each other. Take this snippet:
>
> defmodule MyModule do
>   @some_mod GenServer
>   use @some_mod
> end
>
> You would not be able to reorder these statements without breaking things.
>
> These kinds of checks belong in a linter, not a formatter, such as Credo 
> (as you already mentioned). The fact that these changes are not applied 
> automatically right now doesn't mean that they couldn't in the future 🙃. 
> It might be useful for Credo to be able to apply some automatic fixes if it 
> doesn't already have this ability.
>
> Thanks for the proposal though!
>
> Andrea
>
> On Friday, March 18, 2022 at 2:01:28 PM UTC+1 Wojtek Mach wrote:
>
>> I don't think the proposal is going to be accepted. A very important 
>> design goal of `mix format` is never to change the semantics of the code 
>> and changing the order of statements is changing semantics.
>>
>> On March 18, 2022, elixir-lang-core <[email protected]> wrote:
>>
>> The Elixir style guide has guidance on how to organise module attributes, 
>> directives, and macros - 
>> https://github.com/christopheradams/elixir_style_guide#module-attribute-ordering
>>  
>>
>> What do people think about applying these conventions as part of mix 
>> format?
>>
>> Background - we have linting rules using credo which check these 
>> conventions, but no way to automatically apply fixes at the moment, which 
>> means it can be a bit painful to do that manually. Feels like mix format 
>> might be a good place for this to live.
>>
>>  -- 
>>  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 [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elixir-lang-core/598e7f82-aa62-45a6-ab33-4f5f3593befcn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elixir-lang-core/598e7f82-aa62-45a6-ab33-4f5f3593befcn%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/5719fc9d-d7bc-4feb-8b20-6f9a18ae72f7n%40googlegroups.com.

Reply via email to