An opinionated style guide for writing consistent, readable Elixir code with best practices and conventions.
The Elixir Style Guide is an opinionated collection of coding conventions and best practices for the Elixir programming language. It provides detailed guidelines on naming, formatting, code organization, and idiomatic patterns to help developers write consistent and maintainable Elixir code. The guide covers everything from basic syntax to advanced language features.
Elixir developers and teams looking to establish consistent coding standards across their projects. It's particularly valuable for code reviewers, technical leads, and developers contributing to shared codebases.
This guide offers comprehensive, well-reasoned conventions that go beyond basic syntax rules. It helps teams avoid common pitfalls, improves code readability, and aligns with Elixir's built-in formatter and community practices.
An opinionated Elixir style guide
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Covers naming, formatting, modules, error handling, and more with detailed examples, such as clear rules for snake_case variables and CamelCase modules, as outlined in the Naming and Modules sections.
Emphasizes code readability and consistency with quotes and reasoning, reinforcing that code is for programmers, not just machines, as seen in the introductory quote and commentary on comments.
Explicitly notes that formatting rules align with Elixir's built-in formatter from v1.6, ensuring compatibility with standard tooling and reducing configuration overhead.
Provides 'Bad' and 'Good' code snippets for each rule, such as in the pipeline operator and error handling sections, making guidelines easy to understand and apply.
As a documentation-only guide, it lacks automated tooling; teams must rely on code reviews or external linters like Credo to enforce rules, which can lead to inconsistency without diligent adoption.
Some conventions, like avoiding anonymous functions in pipelines or strict boolean operator usage, may be restrictive for certain use cases and not universally accepted, potentially stifling developer flexibility.
The formatting section is largely handled by Elixir's built-in formatter, making detailed guidelines on whitespace and indentation unnecessary for projects already using the formatter, as acknowledged in the README.