All Projects → uohzxela → ex_format

uohzxela / ex_format

Licence: MIT license
ExFormat formats Elixir source code according to a standard set of rules

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to ex format

StyLua
An opinionated Lua code formatter
Stars: ✭ 479 (+1128.21%)
Mutual labels:  formatter, pretty-printer
prettier-check
Check that all files match prettier code style.
Stars: ✭ 54 (+38.46%)
Mutual labels:  formatter, code-style
Editorconfig Netbeans
A NetBeans IDE plugin supporting the EditorConfig standard. ⛺
Stars: ✭ 123 (+215.38%)
Mutual labels:  formatter, code-style
pretty print formatter
Pretty Print Formatter for Elixir Logger module -- Colorize Ecto's SQL ouput 🖌️
Stars: ✭ 22 (-43.59%)
Mutual labels:  formatter, pretty-printer
Laravel Code Style
Automatic code formatting for Laravel projects
Stars: ✭ 344 (+782.05%)
Mutual labels:  formatter, code-style
Elm Format
elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
Stars: ✭ 1,240 (+3079.49%)
Mutual labels:  formatter, code-style
Uncrustify
Code beautifier
Stars: ✭ 2,442 (+6161.54%)
Mutual labels:  formatter, code-style
plugin-pug
Prettier Pug Plugin
Stars: ✭ 163 (+317.95%)
Mutual labels:  formatter
json.pizza
Online JSON formatter and prettifier
Stars: ✭ 72 (+84.62%)
Mutual labels:  formatter
address-format
A PHP library to parse street addresses to localized formats
Stars: ✭ 76 (+94.87%)
Mutual labels:  formatter
sexp-grammar
Invertible parsing for S-expressions
Stars: ✭ 28 (-28.21%)
Mutual labels:  pretty-printer
jsonfmt
Like gofmt, but for JSON files.
Stars: ✭ 70 (+79.49%)
Mutual labels:  formatter
AdvancedHTMLParser
Fast Indexed python HTML parser which builds a DOM node tree, providing common getElementsBy* functions for scraping, testing, modification, and formatting. Also XPath.
Stars: ✭ 90 (+130.77%)
Mutual labels:  formatter
go-qmk-keymap
This is a utility that can format your keymap array of layers as well as generating ascii-art diagrams of those layouts.
Stars: ✭ 20 (-48.72%)
Mutual labels:  formatter
table2ascii
Python library for converting lists to fancy ASCII tables for displaying in the terminal and on Discord
Stars: ✭ 31 (-20.51%)
Mutual labels:  formatter
format-imports-vscode
Format imports and exports for JavaScript and TypeScript in VS Code.
Stars: ✭ 60 (+53.85%)
Mutual labels:  formatter
DemoApp
An Android template project for fast development and test.
Stars: ✭ 33 (-15.38%)
Mutual labels:  code-style
scheduler
Laravel on my way
Stars: ✭ 20 (-48.72%)
Mutual labels:  code-style
ts-standard
Typescript style guide, linter, and formatter using StandardJS
Stars: ✭ 338 (+766.67%)
Mutual labels:  code-style
laravel-formatters
«‎Formatter» pattern for Laravel
Stars: ✭ 86 (+120.51%)
Mutual labels:  formatter

ExFormat

Hex.pm

ExFormat formats Elixir source code according to a standard set of rules based on the elixir-style-guide. It tries its best to accommodate the user's intent by preserving intended layout and syntax. The documentation is available online.

Note: ExFormat is a prototype. For a production-ready version, please have a look at the latest code formatter that's under development by the Elixir core team.

Requirements

  • Erlang/OTP 20
  • Mix v1.5.1

Installation

As ExFormat works best with the unreleased Elixir v1.6, it is recommended to download the prebuilt escript (which embeds Elixir v1.6 in itself) and run it as an executable.

mix escript.install https://github.com/uohzxela/ex_format/raw/master/ex_format

If you haven't done so already, consider adding ~/.mix/escripts directory to your PATH environment variable.

Usage

# Change directory to your Elixir project
cd to/your/elixir/project

# Formats all files that match each wildcard
ex_format lib/**/*.ex config/**/*.exs

Background info

For those who are curious, the formatter is created by following these steps:

  1. Parse source code into AST
  2. Augment the AST nodes with metadata such comments and line breaks
  3. Do a recursive descent on the AST starting from the topmost node
  4. Pattern match on each node, format it according to the style guide and continue to recurse down its children nodes

Hence, conceptually, this is a very simple formatter and is a good example of how pattern matching works in practice.

There are also contributions to Elixir tokenizer and parser to augment the AST with the necessary metadata for formatting, you can check these out here.

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].