elixir-styler icon indicating copy to clipboard operation
elixir-styler copied to clipboard

extract module attribute values to variables when moving them below references

Open novaugust opened this issue 2 years ago • 0 comments

this would fix the compilation-breakage that is detailed in the readme

# before
defmodule MyGreatLibrary do
  @library_options [ ... ]
  @moduledoc make_pretty_docs(@library_options)
  use OptionsMagic, my_opts: @library_options

end

# after
library_options = [ ... ]

defmodule MyGreatLibrary do
  @moduledoc make_pretty_docs(library_options)
  use OptionsMagic, my_opts: unquote(library_options)

  @library_options library_options
end

there'll likely be many edge cases to consider with this system, but i'm happy shipping it with just this test passing

novaugust avatar Apr 10 '24 15:04 novaugust