All Projects → lpil → Exfmt

lpil / Exfmt

Licence: apache-2.0
🌸 An opinionated Elixir source code formatter

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Exfmt

dart-more
More Dart — Literally.
Stars: ✭ 81 (-81.8%)
Mutual labels:  formatter, printer
Prettier
Prettier is an opinionated code formatter.
Stars: ✭ 41,411 (+9205.84%)
Mutual labels:  printer, formatter
Plugin Php
Prettier PHP Plugin
Stars: ✭ 1,243 (+179.33%)
Mutual labels:  printer, formatter
StyLua
An opinionated Lua code formatter
Stars: ✭ 479 (+7.64%)
Mutual labels:  formatter, printer
Isort
A Python utility / library to sort imports.
Stars: ✭ 4,377 (+883.6%)
Mutual labels:  formatter
Proto
parser for Google ProtocolBuffers definition
Stars: ✭ 359 (-19.33%)
Mutual labels:  formatter
Laravel Code Style
Automatic code formatting for Laravel projects
Stars: ✭ 344 (-22.7%)
Mutual labels:  formatter
Scale
🎏 Unit converter in Swift
Stars: ✭ 324 (-27.19%)
Mutual labels:  formatter
Node Thermal Printer
This npm package was made to control epson and star thermal printers
Stars: ✭ 424 (-4.72%)
Mutual labels:  printer
Coolformat
CoolFormat Source Code Formatter
Stars: ✭ 392 (-11.91%)
Mutual labels:  formatter
Snazzy
Format JavaScript Standard Style as Stylish (i.e. snazzy) output
Stars: ✭ 381 (-14.38%)
Mutual labels:  formatter
Durafmt
🕗 Better time duration formatting in Go!
Stars: ✭ 362 (-18.65%)
Mutual labels:  formatter
Swaggen
OpenAPI/Swagger 3.0 Parser and Swift code generator
Stars: ✭ 385 (-13.48%)
Mutual labels:  formatter
Rustfmt
Format Rust code
Stars: ✭ 4,049 (+809.89%)
Mutual labels:  formatter
Google Java Format
Reformats Java source code to comply with Google Java Style.
Stars: ✭ 4,250 (+855.06%)
Mutual labels:  formatter
Marlin Config
Marlin firmware instant configurator
Stars: ✭ 327 (-26.52%)
Mutual labels:  printer
Ceras
Universal binary serializer for a wide variety of scenarios https://discord.gg/FGaCX4c
Stars: ✭ 374 (-15.96%)
Mutual labels:  formatter
Prettier Vscode
Visual Studio Code extension for Prettier
Stars: ✭ 4,085 (+817.98%)
Mutual labels:  formatter
Sh
A shell parser, formatter, and interpreter with bash support; includes shfmt
Stars: ✭ 4,343 (+875.96%)
Mutual labels:  formatter
Shsphonecomponent
UITextField and NSFormatter subclasses for formatting phone numbers. Allow different formats for different countries(patterns).
Stars: ✭ 367 (-17.53%)
Mutual labels:  formatter

Circle CI Hex version API Docs Licence

exfmt 🌸

This tool has been deprecated

With the new formatter in Elixir v1.6 there is no need for this formatter any more. Thanks for checking out exfmt, it's been fun. :)

Intro

exfmt is in alpha. If you run into any problems, please report them.

The format produced by exfmt will change significantly before the 1.0.0 release. If this will cause problems for you, please refrain from using exfmt during the alpha- and beta-test periods.

exfmt is inspired by Aaron VonderHaar's elm-format, and aims to format Elixir source code largely according to the standards defined in Aleksei Magusev's Elixir Style Guide.

# exfmt takes any Elixir code...

defmodule MyApp, do: (
    use( SomeLib )
    def run( data ), do: {
      :ok,
      data
   }
)

# and rewrites it in a clean and idiomatic style:

defmodule MyApp do
  use SomeLib

  def run(data) do
    {:ok, data}
  end
end

The benefits of exfmt:

  • It makes code easier to write, because you never have to worry about minor formatting concerns while powering out new code.
  • It makes code easier to read, because there are no longer distracting minor stylistic differences between different code bases. As such, your brain can map more efficiently from source to mental model.
  • It makes code easier to maintain, because you can no longer have diffs related only to formatting; every diff necessarily involves a material change.
  • It saves your team time debating how to format things, because there is a standard tool that formats everything the same way.
  • It saves you time because you don't have to nitpick over formatting details of your code.

Contents

Usage

mix exfmt path/to/file.ex

Command line options

  • --check - Check if file is formatted, sets exit status to 1 if false.
  • --stdin - Read from STDIN instead of a file.
  • --unsafe - Disable the semantics check that verifies that exmft has not altered the semantic meaning of the input file.

Installation

exfmt makes use of Elixir compiler features coming in Elixir v1.6.0 and as a result can only be run with Elixir v1.6-dev off the Elixir master branch, which you will need to download and compile yourself. Use with earlier versions may work without crashing, but the output format will be incorrect.

An easier method of installation will be available when Elixir v1.6.0 is released. Or sooner, perhaps!

Editor integration

Atom

Atom users can install Ron Green's exfmt-atom package.

Vim

Vim users can use exfmt with Steve Dignam's Neoformat.

Once installed the following config will enable formatting of the current Elixir buffer using :Neoformat. For further instructions, please reference the Neoformat documentation.

let g:neoformat_elixir_exfmt = {
  \ 'exe': 'mix',
  \ 'args': ['exfmt', '--stdin'],
  \ 'stdin': 1
  \ }

let g:neoformat_enabled_elixir = ['exfmt']

Visual Studio Code

VSCode users can use exfmt with James Hrisho's vscode-exfmt package.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].