Fetching contributors…
Cannot retrieve contributors at this time
632 lines (420 sloc) 17.1 KB



  • Fixed "unnecessary atom quotes" compiler warning during analysis


  • Switch poison for jason
  • Add command-line switch to load a custom configuration file (--config-file)
  • Add a debug report in HTML format when running Credo using --debug
  • Add node_modules/ to default file excludes
  • Add :ignore_urls param for MaxLineLength
  • Report violation for not as well as ! in Refactor.NegatedConditionWithElse
  • Fix false positive on LargeNumbers
  • Fix NegatedConditionWithElse for not/2 as well
  • Disable PreferUnquotedAtoms for Elixir >= 1.7.0

New checks

  • Credo.Check.Refactor.MapInto


  • Fix bug in Scope
  • Fix false positive in MatchInConditionTest
  • Fix false positive in UnusedEnumOperation
  • Fix custom tasks by resolving config before validating it
  • Add text support to --min-priority CLI switch (you can now set it to low/normal/high)

New checks

  • Credo.Check.Readability.AliasOrder


  • Add :ignore_comments param to LongQuoteBlocks
  • Fix false positive in UnusedPathOperation


  • Fix false positive in SpaceAroundOperators
  • Fix false positive in UnusedEnumOperation


  • Add JSON support
  • Ensure compatibility with Elixir 1.6
  • Format codebase using Elixir 1.6 Formatter
  • Rework internals in preparation of 1.0 release
  • Credo now requires Elixir 1.4
  • Include test directory in default config
  • Add excluded_argument_types to PipeChainStart
  • Emit warnings for non-existing checks, which are referenced in config
  • Improve VariableNames
  • ModuleDoc now raises an issue for empty strings in @moduledoc tags
  • Fix bug on ModuleNames
  • Fix false positive in VariableRebinding
  • Fix false positive in SpaceAroundOperators
  • Fix false positive on BoolOperationOnSameValues
  • Fix false positive on SpaceAfterCommas
  • Fix false positive on MaxLineLength
  • Fix false positive in ParenthesesInCondition
  • Remove NameRedeclarationBy* checks
  • Remove support for @lint attributes


  • Maintenance release


  • Fix false positive in ParenthesesInCondition
  • Fix Code.to_tokens/1 for Elixir 1.6
  • Fix documentation for several checks

New checks

  • Credo.Check.Warning.ExpensiveEmptyEnumCheck


  • Fix false positive for LargeNumbers
  • Fix SpaceAroundOperators for @type module attributes
  • Ignore def arguments and specs for OperationOnSameValues
  • Fix crash in ParenthesesOnZeroArityDefs for variables named defp
  • Fix false positives for TagHelper


  • Fix false positive in ModuleAttributeNames
  • Fix false positives in unused return checks
  • Fix underlining in "list" action
  • Fix CLI argument parsing for mix credo.gen.check
  • Fix loading of custom checks
  • Prevent error when run against empty umbrella projects
  • Prevent output for tests


  • Fix false positive in SpaceAfterCommas
  • Fix false positive in SpaceAroundOperators
  • Fix bug with extracting explain command args
  • Allow anonymous functions to be piped as raw values


  • Speed up scope counting in CLI summary


  • Remove CheckForUpdates for good
  • Fix RaiseInsideRescue for implicit try


  • Do not run CheckForUpdates on CI systems and in editor integrations


  • Refactor all consistency checks, providing a nice speed improvement (thx @little-bobby-tables)
  • Improve Elixir 1.5 compatibility


  • Fix misleading issue message for LongQuoteBlocks


  • Load source files in parallel
  • Improve high memory consumption
  • Fix comment handling of Charlists, Sigils and Strings
  • LazyLogging now only checks for debug calls by default
  • Add --mute-exit-status CLI switch, which mutes Credo's exit status (this will be used for integration tests as it means that any non-zero exit status results from a runtime error of Credo)
  • Add default param values to mix explain output
  • TagTODO and TagFIXME now also report tags from doc-related module attributes (@doc, @moduledoc, @shortdoc)
  • Fix false positives for TrailingWhiteSpace
  • Fix compiler warnings for Sigils


These changes concern people writing their own checks for Credo.

  • Credo.SourceFile struct was refactored: source, lines and ast are now stored in ETS tables.
  • Credo.Config struct was replaced by Credo.Execution.
  • run/3 callbacks for Credo.Check are now run/4 callbacks as they have to receive the execution's Credo.Execution struct.

Config Comments replace @lint attributes

@lint attributes are deprecated and will be removed in Credo 0.9.0 because they are causing a compiler warning in Elixir >= 1.4.

Users of Credo can now disable individual lines or files for all or just specific checks.

For now, config comments let you exclude individual files completely

# credo:disable-for-this-file
defmodule SomeApp.ThirdPartyCode do

or deactivate specific lines:

def my_fun do
  # credo:disable-for-next-line
  IO.inspect :this_is_actually_okay

or add the check module to exclude just that one check:

def my_fun do
  # credo:disable-for-next-line Credo.Check.Warning.IoInspect
  IO.inspect :this_is_actually_okay

or use a Regex to be more flexible which checks to exclude:

def my_fun do
  # credo:disable-for-next-line /IoInspect/
  IO.inspect :this_is_actually_okay

Here's a list with the syntax options:

  • # credo:disable-for-this-file - to disable for the entire file
  • # credo:disable-for-next-line - to disable for the next line
  • # credo:disable-for-previous-line - to disable for the previous line
  • # credo:disable-for-lines:<count> - to disable for the given number of lines (negative for previous lines)

New checks

  • Credo.Check.Refactor.LongQuoteBlocks


  • Fix false positives in SpacesAroundOperators
  • Fix --all CLI switch
  • Always enforce strict mode for <filename>:<line_no>
  • Improve docs on checks
  • Disable MultiAliasImportRequireUse by default

Disabled checks

  • Credo.Check.Consistency.MultiAliasImportRequireUse


  • Fix filename annotation when using --read-from-stdin
  • Fix filename handling on Windows
  • Fix consistency checks triggered by contents of sigils
  • Fix consistency checks triggered by contents of charlists

New check

  • Credo.Check.Warning.LazyLogging


  • Fix @lint attribute deprecation hint
  • Fix filename handling bug for Windows
  • Fix flycheck formatting
  • Add param to ignore strings/heredocs in TrailingWhiteSpace

New check

  • Credo.Check.Readability.SpaceAfterCommas


  • Fix --config_nameCLI switch
  • Fix UI.wrap_at/2 for Unicode strings
  • Fix false positive for ModuleNames


  • Added deprecation hint about @lint attributes
  • Fixed file inclusion/exclusion bug
  • Fixed false positives in SpaceAroundOperators
  • Deprecated NameRedeclarationBy* checks
  • Fixed false positives in PipeChainStart
  • Changed AppendSingleItem's priority and make it opt-in
  • Renamed NoParenthesesWhenZeroArity to ParenthesesOnZeroArityDefs
  • Fixed a bug in ParenthesesOnZeroArityDefs

Added/deprecated checks

  • Credo.Check.Warning.MapGetUnsafePass
  • Credo.Check.Refactor.AppendSingleItem
  • Credo.Check.Readability.Semicolons

Switched some checks to opt-in by default

  • Credo.Check.Readability.Specs
  • Credo.Check.Refactor.ABCSize
  • Credo.Check.Refactor.VariableRebinding
  • Credo.Check.Warning.MapGetUnsafePass
  • Credo.Check.Warning.NameRedeclarationByAssignment
  • Credo.Check.Warning.NameRedeclarationByCase
  • Credo.Check.Warning.NameRedeclarationByDef
  • Credo.Check.Warning.NameRedeclarationByFn


  • Fixed false positives for StringSigils in heredocs
  • Fixed a bug in SourceFile.column


  • Do not warn about ParenthesesInCondition in one-line if call
  • Add --no-strict CLI switch
  • Fixed exit status for mix credo list
  • Fixed exclusion of checks set to low priority

New Checks

  • consistency/multi_alias_import_require_use
  • readability/no_parentheses_when_zero_arity
  • readability/redundant_blank_lines
  • readability/single_pipe
  • readability/specs
  • readability/string_sigils
  • refactor/double_boolean_negation
  • refactor/variable_rebinding


  • Fix crash in CheckForUpdates


  • Add ability to specify strict in .credo.exs config file
  • Add no_case? to variable name checks
  • Add utility method
  • Fix bug in NameRedeclarationByDef
  • Fix bug in LargeNumbers


  • Use API to retrieve update information for Credo


  • See below


  • Fix compiler error due to usage of undocumented Hex APIs (sorry)


  • Prevent crashing when parsing non-UTF-8 source files
  • Fix yet another issue with finding sources
  • Fix false positives for PipeChainStart
  • Fix false positives for AbcSize
  • Remove dead code
  • Update deps


  • Prevent ModuleDoc from checking nested modules for ignored modules
  • Fix issue with ParenthesesInCondition
  • Fix issue with PipChainStart
  • Fix issue with reading from stdin
  • Log errors to stderr


  • Fix compatibility issues with Elixir < 1.2
  • Fix yet another issue with finding sources


  • Fix another issue with finding sources


  • Fix issues with finding sources
  • Don't enforce @moduledoc requirement for Mixfile or Test modules


  • Add exclude_functions option to PipeChainStart
  • No longer report issues in case of ambiguous aliases in AliasUsage
  • Fix false positives for LargeNumbers in Elixir >= 1.3.2 (again)
  • Lots of refactorings


  • Ignore module attributes like @spec in AliasUsage
  • Improve source file loading


  • Add ignore_specs option to MaxLineLength
  • Fix false positives for LargeNumbers in Elixir >= 1.3.2
  • Fix compiler warnings in preparation for Elixir v1.4


  • Warnings about redeclaring names of Kernel or local functions now only consider function of arity zero.
  • Warnings for operations with constant result now ignore division by 1
  • Better explanation how to configure checks in explain output


  • New check: readability/parentheses_in_condition


  • Fix compatibility issues in Credo.CLI.Command.GenCheck for Elixir < 1.2


  • Fix outdated comments regarding .credo.exs in README
  • Fix name generator including "Lib." prefix for custom checks


  • Maintenance release because I apparently don't understand how merging works 😓


Custom check support

  • Adds support for custom checks in your projects.

    Using two new mix commands mix credo.gen.config and mix credo.gen.check you can generate the boilerplate to include custom checks in your projects.

BREAKING CHANGE: Checks listed in .credo.exs

  • Prior to v0.4.0, .credo.exs contained the full list of checks specific to your project
  • Starting with v0.4.0 the check list in credo.exs will be merged with the standard check list, with your definitions overwriting the defaults
  • PRO: you can customize individual tasks to your liking and still benefit from additional standard checks with each new release
  • CON: this means checks have to be disabled explicitly in .credo.exs

New Checks

  • readability/large_numbers
  • warning/bool_operation_on_same_values
  • warning/unused_file_operation
  • warning/unused_path_operation
  • warning/unused_regex_operation

Minor Improvements

  • Ready for Elixir 1.3
  • Checks for new Credo versions automatically, like Hex does (can be disabled)
  • Umbrella apps work out of the box now
  • DuplicatedCode can now ignore macro calls
  • ModuleDoc now ignores modules declaring exceptions
  • ModuleDoc now allows modules to be ignored based on their name
  • MatchInCondition now allows "simple" wildcard assignments in conditionals
  • Checks analysing all files in the codebase sequentially (consistency checks) are now run in parallel
  • If --only is given, all issues are shown (mix credo --only MaxLineLength previously yielded no results, since all issues needed --strict to actually be displayed)


  • Fix false positives for NameRedeclarationByDef.
  • Fix false positives for UnusedEnumOperation.


  • Fix false positives for SpaceInParentheses.
  • Fix false positive for SpaceAroundOperators.


  • Fix a bug with checks on function names when declaring a variable with the name def, defp or defmacro.


  • Fix a bug resulting in UnicodeConversionError for code containing UTF-8 comments.


  • Fix a bug in AliasUsage.


  • Fix false positives for AliasUsage.


  • Fix false positive for SpaceAroundOperators.


  • Fix false positives for SpaceAroundOperators and PipeChainStart.
  • Add option to read from STDIN for better editor integration


  • Remove superfluous call to IO.inspect.
  • Update deps requirements to make HexFaktor happy.


  • Fix false positives for SpaceAroundOperators in binary pattern matches.
  • Fix a bug when supplying a single file via the CLI.


  • Fix false positives for SpaceAroundOperators and SpaceInParentheses.


  • mix do credo, <something-else> was broken and never ran <something-else>, even if credo succeeded (exited with exit status 0). Now it runs <something-else> as long as credo succeeds.


  • Fix compiler warnings
  • Improve copywriting for consistency checks (thx @vdaniuk)


Per-function lint support

  • Adds support for @lint attributes used to configure linting for specific functions.

    For now, this lets you exclude functions completely

    @lint false
    def my_fun do

    or deactivate specific checks with the same syntax used in the config file:

    @lint {Credo.Check.Design.TagTODO, false}
    def my_fun do

    or use a Regex instead of the check module to exclude multiple checks at once:

    @lint {~r/Refactor/, false}
    def my_fun do

    Finally, you can supply multiple tuples as a list and combine the above:

    @lint [{Credo.Check.Design.TagTODO, false}, {~r/Refactor/, false}]
    def my_fun do

New Checks

  • consistency/space_around_operators
  • consistency/space_in_parentheses

Minor Improvements

  • Add --format CLI switch
  • Include experimental Flycheck support via --format=flycheck
  • Deprecate --one-line CLI switch, use --format=oneline instead
  • Add convenience alias --ignore for --ignore-checks
  • Fix colors for terminals with light backgrounds (thx @lucasmazza)


  • Fix false positives for UnusedEnumOperation checks (thx @kbaird)


  • Fix error occuring when a project has exactly one defexception module
  • Change the tag for Refactoring Opportunities from "[R]" to "[F]" (thx @rranelli)


  • Remove unused alias to avoid warning during compilation


  • Improves docs and UI wording (thx @crack and @jessejanderson)


  • Adds a missing word to the output of the categories command (thx @bakkdoor)


  • Fixes a problem with CaseTrivialMatches crashing


Error Status

Credo now fails with an exit status != 0 if it shows any issues. This will enable usage of Credo inside CI systems/build chains.

The exit status of each check is customizable and exit statuses of all encountered checks are collected, uniqued and summed:

|> Enum.uniq
|> Enum.reduce(0, &(&1+&2))

This way you can reason about the encountered issues right from the exit status.

Default values for the checks are based on their category:

consistency:  1
design:       2
readability:  4
refactor:     8
warning:     16

So an exit status of 12 tells you that you have only Readability Issues and Refactoring Opportunities, but e.g. no Warnings.

New Checks

  • readability/module_doc
  • refactor/case_trivial_matches
  • refactor/cond_statements
  • refactor/function_arity
  • refactor/match_in_condition
  • refactor/pipe_chain_start
  • warning/operation_with_constant_result
  • warning/unused_enum_operation
  • warning/unused_keyword_operation
  • warning/unused_list_operation
  • warning/unused_tuple_operation

Minor Improvements

  • There are two new aliases for command line switches:
    • you can use --only as alias for --checks
    • you can use --strict as alias for --all-priorities
  • mix credo --only <checkname> will always display a full list of results (you no longer need to specify --all separately)
  • mix credo explain <file:line_number> now also explains the available configuration parameters for the issue/check
  • The ExceptionNames check no longer fails if only a single exception module is found (#22).


  • Apply many fixes in anticipation of Elixir v1.2 (thx @c-rack)
  • Improve docs
  • Wrap long issue descriptions in suggest command


  • Add missing -A alias for --all-priorities
  • Improve wording in the CLI a bit


  • Add apps/ to default directories


  • Bugfix to NameRedeclarationBy\* checks
  • Sources.exclude had a bug when excluding directories


  • Rename CLI switch --pedantic to --all-priorities (alias is -A)
  • Fix a bug in SourceFile.column (#7)
  • Improve README section about basic usage, commands and issues

0.1.1 - 0.1.5

Multiple Hex releases due to the fact that I apparently don't understand how deps compilation works 😓


Initial release