Elixir Style Guide - Coding Standards & Best Practices

Explore the Elixir style guide for coding standards, best practices, and naming conventions. Learn about module, record, protocol, behavior names, and identifier formatting.

Elixir Style Guide

Elixir Coding Standards

Adhering to a consistent style guide is crucial for maintainable and readable Elixir code. This guide outlines the recommended conventions for naming, formatting, and structuring your Elixir projects.

Naming Conventions

Module, Record, Protocol, and Behavior Names

All module, record, protocol, and behavior names should start with an initial capital letter and follow the BumpyCase convention.

MyModule

Other Identifiers

All other identifiers, including variables, functions, and atoms, should start with a lowercase letter or an underscore and follow the snake_case convention.

in_the_air_tonight

Code Formatting

Indentation

Use 2 spaces for indentation. Tabs are strictly prohibited to ensure consistent formatting across different editors and environments.

Additional Notes

For visualizing regular expressions, the following tool is recommended:

Regex Visualizer: http://jex.im/regulex/