Dogma v0.1.16 API Reference

Modules

Dogma is a tool for enforcing a consistent Elixir code style within your project,the idea being that if your code is easier to read, it should also be easier to understand

Responsible for gathering all the configuration state required to run Dogma

Generates a documentation file for reporters

Generate documentation file detailing all rules

This module provides the struct we use to represent errors found in a file by Rules. These %Errors are to be passed to and reported by a formatter

A machine-readable format suitable for integration with tools like Flycheck or Syntastic

A machine readable format in JSON

A reporter that prints a dot per file, followed by details at the end

Lists available reporters

A rule that disallows comments with no space between the # and the comment text

A rule that disallows comparison to booleans

A rule that disallows calls to IEx.pry

A Rule that checks that exception names end with a trailing Error

A rule that checks that the last condition of a cond statement is true

A rule that disallows files that don’t end with a final newline

A rule that disallows functions and macros with arity greater than 4, meaning a function may not take more than 4 arguments

A rule that disallows function names not in snake_case

A rule that ensures function declarations use parentheses if and only if they have arguments

Requires that all indentation is done using spaces rather than hard tabs

A rule that ensures that all infix operators, except the range operator .., are surrounded by spaces

A rule that disallows strings which are entirely the result of an interpolation

A rule that disallows lines longer than X characters in length (defaults to 80)

A rule that disallows useless conditional statements that contain a literal in place of a variable or predicate function

A rule that disallows useless string interpolations that contain a literal value instead of a variable or function. Examples

Disallows use of the match operator in the conditional constructs if and unless. This is because it is often intended to be == instead, but was mistyped. Also, since a failed match raises a MatchError, the conditional construct is largely redundant

A rule that disallows module attribute names not in snake_case

A rule which states that all modules must have documentation in the form of a @moduledoc attribute

A rule that disallows module names not in PascalCase

A rule that disallows multiple consecutive blank lines

A rule that disallows the use of an assert or refute with a negated argument. If you do this, swap the assert for an refute, or vice versa

A rule that disallows the use of an if or unless with a negated predicate. If you do this, swap the if for an unless, or vice versa

A rule that enforces that function chains always begin with a bare value, rather than a function call with arguments

A rule that disallows tautological predicate names, meaning those that start with the prefix has_ or the prefix is_

A rule that disallows strings containing the double quote character (")

A rule that disallows semicolons to terminate or separate statements

A rule that enforces to use at least spaces after comma

A rule that disallows function or macro names which overrides standard lib

A rule that disallows trailing blank lines as the end of a source file

A rule that disallows trailing whitespace at the end of a line

A rule that disallows the use of an else block with the unless macro

A rule that disallows variable names not in snake_case

A rule that disallows any lines terminated with \r\n, the line terminator commonly used on the Windows operating system

The provider of the defrule/3 macro through which we define rules

The RuleSet behaviour, used to assert the interface used by our RuleSets

The module which defines all the rules to run in Dogma

Responsible for running of the appropriate rule set on a given set of scripts with the appropriate configuration

Run each of the given on the given script

This module provides the struct that we use to represent source files, their abstract syntax tree, etc, as well as a few convenient functions for working with them

Responsible for extracting comments and contained metadata from a source string

A module responsible for the identifying of Elixir source files to be analyised by Dogma

Utility functions for analyzing and categorizing AST asts

We want to have inline changes of Dogma config using comments, so we need a way of getting the comments out of source code

A module for calculating the cyclomatic complexity for an AST

Splits a source string into lines. Amazing!

Utility functions for analysing names

A preprocessor for scripts, to be used on the script string before the AST, lines, etc have been computed for it

A preprocessor for scripts, to be used on the script string before the AST, lines, etc have been computed for it

Check Elixir source files for style violations

Exceptions

An exception that can raised when source has invalid syntax

Protocols