Skip to content

Latest commit

 

History

History
90 lines (66 loc) · 3.54 KB

README.md

File metadata and controls

90 lines (66 loc) · 3.54 KB

Hex.pm Hexdocs.pm Github.com

Quokka

Quokka is an Elixir formatter plugin that's combination of mix format and mix credo, except instead of telling you what's wrong, it just rewrites the code for you to fit its style rules.

Quokka is a fork of Styler that checks the credo config to determine which rules to rewrite.

Features

See our Rewrites documentation on hexdocs

Installation

Add :quokka as a dependency to your project's mix.exs:

def deps do
  [
    {:quokka, "~> 0.1", only: [:dev, :test], runtime: false},
  ]
end

Then add Quokka as a plugin to your .formatter.exs file

[
  plugins: [Quokka]
]

And that's it! Now when you run mix format you'll also get the benefits of Quokka's Stylish Stylings.

Speed: Expect the first run to take some time as Quokka rewrites violations of styles and bottlenecks on disk I/O. Subsequent formats formats won't take noticeably more time.

Configuration

Quokka can be configured in your .formatter.exs file

[
  plugins: [Quokka],
  quokka: [
    alias_lifting_exclude: [...],
    reorder_configs: true | false
  ]
]

Quokka has several configuration options:

  • :alias_lifting_exclude, which accepts a list of atoms to not lift. See the Module Directive documentation for more
  • :reorder_configs, which controls whether or not the configs in your config/*.exs files are alphabetized. This is true by default.

WARNING: Quokka can change the behaviour of your program!

In some cases, this can introduce bugs. It goes without saying, but look over your changes before committing to main :)

Some ways Quokka can change your program:

License

Quokka is licensed under the Apache 2.0 license. See the LICENSE file for more details.