Use consistent exception names
Use consistent exception names
Error suffix.Use consistent line endings
Use consistent line endings
LF) and Windows (CRLF) line endings creates noisy diffs and inconsistent formatting.Use consistent parameter pattern matching
Use consistent parameter pattern matching
Use consistent spacing around operators
Use consistent spacing around operators
Use consistent spacing inside parentheses
Use consistent spacing inside parentheses
Use consistent indentation
Use consistent indentation
Alias nested modules
Alias nested modules
Order aliases consistently
Order aliases consistently
Use conventional function names
Use conventional function names
snake_case and may end in ? or !.Make large numbers readable
Make large numbers readable
Keep lines within the maximum length
Keep lines within the maximum length
Use conventional module attribute names
Use conventional module attribute names
snake_case.Document modules
Document modules
@moduledoc.Use conventional module names
Use conventional module names
CamelCase without underscores.Avoid unnecessary parentheses in conditions
Avoid unnecessary parentheses in conditions
Avoid parentheses on zero-arity definitions
Avoid parentheses on zero-arity definitions
Avoid piping into anonymous functions
Avoid piping into anonymous functions
Use conventional predicate function names
Use conventional predicate function names
?; reserve is_ names for guards.Prefer implicit try
Prefer implicit try
rescue, catch, and after clauses are clearer without a redundant try.Remove redundant blank lines
Remove redundant blank lines
Avoid semicolons
Avoid semicolons
Add spaces after commas
Add spaces after commas
Use string sigils when they improve readability
Use string sigils when they improve readability
End files with a trailing newline
End files with a trailing newline
Remove trailing whitespace
Remove trailing whitespace
Avoid unnecessary alias expansion
Avoid unnecessary alias expansion
Use conventional variable names
Use conventional variable names
snake_case.Use case for a single-clause with
Use case for a single-clause with
with containing one match and an else branch is clearer as a case.Prefer direct function calls over apply
Prefer direct function calls over apply
Simplify short cond expressions
Simplify short cond expressions
cond with one condition plus a fallback should be an if/else.Reduce cyclomatic complexity
Reduce cyclomatic complexity
Use Enum.count with a predicate
Use Enum.count with a predicate
Enum.count/2.Combine consecutive filters
Combine consecutive filters
Limit function arity
Limit function arity
Keep quote blocks concise
Keep quote blocks concise
Use Enum.map_join
Use Enum.map_join
Enum.map_join/3.Avoid matches in conditions
Avoid matches in conditions
case when control flow depends on the shape of a value.Avoid negated conditions in unless
Avoid negated conditions in unless
unless condition is a double negative.Invert negated conditions with else
Invert negated conditions with else
Reduce control-flow nesting
Reduce control-flow nesting
Remove redundant with clause results
Remove redundant with clause results
Combine consecutive rejects
Combine consecutive rejects
Avoid unless with else
Avoid unless with else
unless with an else branch is easier to understand as an if.Keep with clauses focused on matching
Keep with clauses focused on matching
with and side-effect calls into its body.Do not store runtime configuration in module attributes
Do not store runtime configuration in module attributes
Avoid boolean operations on the same value
Avoid boolean operations on the same value
Remove dbg calls
Remove dbg calls
dbg/2 is intended for local debugging and should not remain in committed application code.Avoid expensive empty-enumerable checks
Avoid expensive empty-enumerable checks
Enum.empty?/1 instead of traversing an enumerable to count every element.Remove IEx.pry calls
Remove IEx.pry calls
IEx.pry pauses a running process and must not remain in application code.Remove IO.inspect calls
Remove IO.inspect calls
Configure Logger metadata keys
Configure Logger metadata keys
Avoid operations on the same value
Avoid operations on the same value
Avoid operations with constant results
Avoid operations with constant results
Preserve stack traces when raising inside rescue
Preserve stack traces when raising inside rescue
reraise/2 when translating an exception so the original stack trace is retained.Reference struct types correctly in specs
Reference struct types correctly in specs
Module.t() avoids an unnecessary compile-time dependency on a struct literal.Avoid unsafe command execution
Avoid unsafe command execution
Use Enum operation results
Use Enum operation results
Enum functions return new values; they do not mutate the input collection.Use File operation results
Use File operation results
File operations.Use Keyword operation results
Use Keyword operation results
Keyword functions return updated lists and do not mutate the original.Use List operation results
Use List operation results
List functions return updated lists and do not mutate the original.Use Path operation results
Use Path operation results
Path functions.Use Regex operation results
Use Regex operation results
Regex operations.Use String operation results
Use String operation results
Use Tuple operation results
Use Tuple operation results
Use the correct test file extension
Use the correct test file extension
.exs so they are executed as scripts by the test runner.Do not evaluate untrusted Elixir code
Do not evaluate untrusted Elixir code
Code.eval_*, which executes code with the application’s privileges.Do not dynamically apply untrusted functions
Do not dynamically apply untrusted functions
apply/3.Do not evaluate untrusted EEx templates
Do not evaluate untrusted EEx templates
Do not load untrusted native libraries
Do not load untrusted native libraries
:erlang.load_nif can execute arbitrary native code.Avoid command injection through :os.cmd
Avoid command injection through :os.cmd
:os.cmd invokes a command processor and must not receive constructed or untrusted commands.Avoid command injection through Port.open
Avoid command injection through Port.open
Port.open.Validate System.cmd commands and arguments
Validate System.cmd commands and arguments
System.cmd.Avoid command injection through System.shell
Avoid command injection through System.shell
System.shell invokes a system shell and must not receive untrusted input.Validate Phoenix WebSocket origins
Validate Phoenix WebSocket origins
Avoid wildcard CORS origins
Avoid wildcard CORS origins
Do not reuse state-changing actions for GET routes
Do not reuse state-changing actions for GET routes
Disable Phoenix debug errors outside development
Disable Phoenix debug errors outside development
Enable Phoenix force_ssl in production
Enable Phoenix force_ssl in production
Configure a Content Security Policy
Configure a Content Security Policy
Enable CSRF protection in browser pipelines
Enable CSRF protection in browser pipelines
:protect_from_forgery.Enable secure browser headers
Enable secure browser headers
Use cryptographically secure randomness
Use cryptographically secure randomness
:rand must not create tokens, credentials, or other security-sensitive values.Avoid weak cryptographic hashes
Avoid weak cryptographic hashes
Avoid atom-table exhaustion
Avoid atom-table exhaustion
Do not compile untrusted regular expressions
Do not compile untrusted regular expressions
Do not deserialize untrusted Erlang terms
Do not deserialize untrusted Erlang terms
:erlang.binary_to_term can allocate attacker-controlled terms and deserialize executable functions.Prevent open redirects
Prevent open redirects
Prevent filesystem path traversal
Prevent filesystem path traversal
Prevent path traversal in send_download
Prevent path traversal in send_download
Prevent path traversal in send_file
Prevent path traversal in send_file
Use parameterized Ecto SQL queries
Use parameterized Ecto SQL queries
Prevent server-side request forgery
Prevent server-side request forgery
Verify TLS certificates
Verify TLS certificates
Do not let users select response content types
Do not let users select response content types
text/html may turn otherwise inert response data into executable script.Escape dynamic Phoenix HTML responses
Escape dynamic Phoenix HTML responses
Do not pass untrusted HTML to raw
Do not pass untrusted HTML to raw
raw bypasses Phoenix HTML escaping and can turn request data into executable markup.Do not send untrusted HTML with send_resp
Do not send untrusted HTML with send_resp