View Source Styler.Style.Configs (Styler v1.2.1)

Orders Config.config/2,3 stanzas in configuration files.

  • ordering is done only within immediate-sibling config statements
  • assignments are moved above the configuration blocks
  • any non config/2,3 or assignment (=/2) calls mark the end of a sorting block. this is support having conditional blocks (if/case/cond) and import_config stanzas between blocks

Breakages

If you configure the same values multiple times, Styler may swap their orders

Before

line 04: config :foo, bar: :zab line 40: config :foo, bar: :baz

# Application.fetch_env!(:foo)[:bar] => :baz

After

line 04: config :foo, bar: :baz line 05: config :foo, bar: :zab

# Application.fetch_env!(:foo)[:bar] => :zab

Fix

The reason Styler sorts configuration is to help you noticed these duplicated configuration stanzas. Delete the duplicative/erroneous stanza and life will be good.

Summary

Functions

Link to this function

set_lines(list, comments, start_line, node_acc, c_acc)

View Source