- 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
toParenthesesOnZeroArityDefs
- Fixed a bug in
ParenthesesOnZeroArityDefs
- 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
- 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
Module.name
utility method - Fix bug in NameRedeclarationByDef
- Fix bug in LargeNumbers
- Use Hex.pm 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 toPipeChainStart
- 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
inAliasUsage
- Improve source file loading
- Add
ignore_specs
option toMaxLineLength
- 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 😓
-
Adds support for custom checks in your projects.
Using two new mix commands
mix credo.gen.config
andmix credo.gen.check
you can generate the boilerplate to include custom checks in your projects.
- 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 incredo.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
- readability/large_numbers
- warning/bool_operation_on_same_values
- warning/unused_file_operation
- warning/unused_path_operation
- warning/unused_regex_operation
- 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
ordefmacro
.
- 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
andPipeChainStart
. - 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
andSpaceInParentheses
.
mix do credo, <something-else>
was broken and never ran<something-else>
, even ifcredo
succeeded (exited with exit status 0). Now it runs<something-else>
as long ascredo
succeeds.
- Fix compiler warnings
- Improve copywriting for consistency checks (thx @vdaniuk)
-
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 end
or deactivate specific checks with the same syntax used in the config file:
@lint {Credo.Check.Design.TagTODO, false} def my_fun do end
or use a Regex instead of the check module to exclude multiple checks at once:
@lint {~r/Refactor/, false} def my_fun do end
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 end
- consistency/space_around_operators
- consistency/space_in_parentheses
- 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
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:
issues
|> Enum.map(&(&1.exit_status))
|> 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.
- 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
- 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
- you can use
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
Multiple Hex releases due to the fact that I apparently don't understand how deps compilation works 😓
Initial release