Permalink
Browse files

Merge branch 'master' into sdc/unsafe-atom-creation

  • Loading branch information...
rrrene committed Oct 27, 2018
2 parents a022d92 + 621be41 commit af4c734928aba55f1ab2066c492b8fcb5521ed38
Showing with 2,632 additions and 1,812 deletions.
  1. +60 −70 .credo.exs
  2. +1 −1 .tool-versions
  3. +12 −2 .travis.yml
  4. +30 −0 CHANGELOG.md
  5. +21 −4 README.md
  6. +9 −0 lib/credo.ex
  7. +2 −0 lib/credo/application.ex
  8. +2 −2 lib/credo/backports/enum.ex
  9. +85 −31 lib/credo/check.ex
  10. +0 −215 lib/credo/check/code_helper.ex
  11. +6 −7 lib/credo/check/config_comment_finder.ex
  12. +2 −2 lib/credo/check/consistency/collector.ex
  13. +4 −4 lib/credo/check/consistency/exception_names.ex
  14. +2 −0 lib/credo/check/consistency/exception_names/collector.ex
  15. +4 −4 lib/credo/check/consistency/line_endings.ex
  16. +2 −0 lib/credo/check/consistency/line_endings/collector.ex
  17. +4 −4 lib/credo/check/consistency/multi_alias_import_require_use.ex
  18. +2 −0 lib/credo/check/consistency/multi_alias_import_require_use/collector.ex
  19. +4 −4 lib/credo/check/consistency/parameter_pattern_matching.ex
  20. +2 −0 lib/credo/check/consistency/parameter_pattern_matching/collector.ex
  21. +6 −6 lib/credo/check/consistency/space_around_operators.ex
  22. +42 −4 lib/credo/check/consistency/space_around_operators/collector.ex
  23. +4 −1 lib/credo/check/consistency/space_around_operators/space_helper.ex
  24. +8 −6 lib/credo/check/consistency/space_in_parentheses.ex
  25. +6 −7 lib/credo/check/consistency/space_in_parentheses/collector.ex
  26. +4 −4 lib/credo/check/consistency/tabs_or_spaces.ex
  27. +2 −0 lib/credo/check/consistency/tabs_or_spaces/collector.ex
  28. +4 −3 lib/credo/check/design/alias_usage.ex
  29. +29 −47 lib/credo/check/design/duplicated_code.ex
  30. +6 −5 lib/credo/check/design/tag_fixme.ex
  31. +4 −3 lib/credo/check/design/tag_helper.ex
  32. +6 −5 lib/credo/check/design/tag_todo.ex
  33. +85 −20 lib/credo/check/readability/alias_order.ex
  34. +6 −5 lib/credo/check/readability/function_names.ex
  35. +8 −5 lib/credo/check/readability/large_numbers.ex
  36. +6 −5 lib/credo/check/readability/max_line_length.ex
  37. +5 −4 lib/credo/check/readability/module_attribute_names.ex
  38. +19 −6 lib/credo/check/readability/module_doc.ex
  39. +5 −4 lib/credo/check/readability/module_names.ex
  40. +4 −3 lib/credo/check/readability/parentheses_in_condition.ex
  41. +4 −3 lib/credo/check/readability/parentheses_on_zero_arity_defs.ex
  42. +4 −3 lib/credo/check/readability/predicate_function_names.ex
  43. +4 −4 lib/credo/check/readability/prefer_implicit_try.ex
  44. +6 −5 lib/credo/check/readability/prefer_unquoted_atoms.ex
  45. +4 −3 lib/credo/check/readability/redundant_blank_lines.ex
  46. +4 −5 lib/credo/check/readability/semicolons.ex
  47. +4 −3 lib/credo/check/readability/single_pipe.ex
  48. +5 −4 lib/credo/check/readability/space_after_commas.ex
  49. +22 −6 lib/credo/check/readability/specs.ex
  50. +4 −3 lib/credo/check/readability/string_sigils.ex
  51. +4 −3 lib/credo/check/readability/trailing_blank_line.ex
  52. +5 −3 lib/credo/check/readability/trailing_white_space.ex
  53. +6 −5 lib/credo/check/readability/variable_names.ex
  54. +56 −46 lib/credo/check/refactor/abc_size.ex
  55. +4 −3 lib/credo/check/refactor/append_single_item.ex
  56. +5 −4 lib/credo/check/refactor/case_trivial_matches.ex
  57. +7 −5 lib/credo/check/refactor/cond_statements.ex
  58. +6 −8 lib/credo/check/refactor/cyclomatic_complexity.ex
  59. +4 −3 lib/credo/check/refactor/double_boolean_negation.ex
  60. +5 −4 lib/credo/check/refactor/function_arity.ex
  61. +0 −6 lib/credo/check/refactor/helper.ex
  62. +6 −4 lib/credo/check/refactor/long_quote_blocks.ex
  63. +4 −3 lib/credo/check/refactor/map_into.ex
  64. +4 −4 lib/credo/check/refactor/match_in_condition.ex
  65. +4 −3 lib/credo/check/refactor/negated_conditions_in_unless.ex
  66. +5 −4 lib/credo/check/refactor/negated_conditions_with_else.ex
  67. +5 −7 lib/credo/check/refactor/nesting.ex
  68. +6 −8 lib/credo/check/refactor/perceived_complexity.ex
  69. +13 −3 lib/credo/check/refactor/pipe_chain_start.ex
  70. +5 −4 lib/credo/check/refactor/unless_with_else.ex
  71. +4 −5 lib/credo/check/refactor/variable_rebinding.ex
  72. +14 −14 lib/credo/check/runner.ex
  73. +5 −4 lib/credo/check/warning/bool_operation_on_same_values.ex
  74. +5 −3 lib/credo/check/warning/expensive_empty_enum_check.ex
  75. +4 −3 lib/credo/check/warning/iex_pry.ex
  76. +4 −3 lib/credo/check/warning/io_inspect.ex
  77. +4 −3 lib/credo/check/warning/lazy_logging.ex
  78. +4 −3 lib/credo/check/warning/map_get_unsafe_pass.ex
  79. +10 −5 lib/credo/check/warning/operation_on_same_values.ex
  80. +4 −3 lib/credo/check/warning/operation_with_constant_result.ex
  81. +5 −3 lib/credo/check/warning/raise_inside_rescue.ex
  82. +22 −45 lib/credo/check/warning/unused_enum_operation.ex
  83. +30 −38 lib/credo/check/warning/unused_file_operation.ex
  84. +16 −17 lib/credo/check/warning/unused_function_return_helper.ex
  85. +32 −36 lib/credo/check/warning/unused_keyword_operation.ex
  86. +28 −36 lib/credo/check/warning/unused_list_operation.ex
  87. +42 −0 lib/credo/check/warning/unused_operation.ex
  88. +27 −36 lib/credo/check/warning/unused_path_operation.ex
  89. +27 −36 lib/credo/check/warning/unused_regex_operation.ex
  90. +13 −35 lib/credo/check/warning/unused_string_operation.ex
  91. +32 −36 lib/credo/check/warning/unused_tuple_operation.ex
  92. +2 −1 lib/credo/cli.ex
  93. +17 −0 lib/credo/cli/command.ex
  94. +4 −3 lib/credo/cli/command/categories/categories_command.ex
  95. +2 −0 lib/credo/cli/command/categories/categories_output.ex
  96. +2 −0 lib/credo/cli/command/categories/output/default.ex
  97. +3 −2 lib/credo/cli/command/explain/explain_command.ex
  98. +5 −2 lib/credo/cli/command/explain/explain_output.ex
  99. +87 −76 lib/credo/cli/command/explain/output/default.ex
  100. +5 −4 lib/credo/cli/command/gen.check.ex
  101. +5 −5 lib/credo/cli/command/gen.config.ex
  102. +3 −2 lib/credo/cli/command/help.ex
  103. +4 −3 lib/credo/cli/command/info/info_command.ex
  104. +2 −0 lib/credo/cli/command/info/info_output.ex
  105. +2 −0 lib/credo/cli/command/info/output/default.ex
  106. +2 −0 lib/credo/cli/command/info/output/json.ex
  107. +3 −2 lib/credo/cli/command/list/list_command.ex
  108. +14 −9 lib/credo/cli/command/list/list_output.ex
  109. +43 −32 lib/credo/cli/command/list/output/default.ex
  110. +2 −0 lib/credo/cli/command/list/output/flycheck.ex
  111. +2 −0 lib/credo/cli/command/list/output/json.ex
  112. +2 −0 lib/credo/cli/command/list/output/oneline.ex
  113. +4 −7 lib/credo/cli/command/suggest/output/default.ex
  114. +2 −0 lib/credo/cli/command/suggest/output/flycheck.ex
  115. +2 −0 lib/credo/cli/command/suggest/output/json.ex
  116. +2 −0 lib/credo/cli/command/suggest/output/oneline.ex
  117. +2 −0 lib/credo/cli/command/suggest/suggest_command.ex
  118. +14 −9 lib/credo/cli/command/suggest/suggest_output.ex
  119. +4 −3 lib/credo/cli/command/version.ex
  120. +4 −0 lib/credo/cli/filter.ex
  121. +2 −0 lib/credo/cli/options.ex
  122. +35 −4 lib/credo/cli/output.ex
  123. +2 −0 lib/credo/cli/output/formatter/flycheck.ex
  124. +2 −0 lib/credo/cli/output/formatter/json.ex
  125. +2 −0 lib/credo/cli/output/formatter/oneline.ex
  126. +5 −4 lib/credo/cli/output/shell.ex
  127. +11 −7 lib/credo/cli/output/summary.ex
  128. +12 −0 lib/credo/cli/output/ui.ex
  129. +4 −0 lib/credo/cli/sorter.ex
  130. +7 −4 lib/credo/cli/task/load_and_validate_source_files.ex
  131. +9 −7 lib/credo/cli/task/prepare_checks_to_run.ex
  132. +2 −0 lib/credo/cli/task/run_checks.ex
  133. +2 −0 lib/credo/cli/task/set_relevant_issues.ex
  134. +121 −13 lib/credo/code.ex
  135. +2 −2 lib/credo/code/heredocs.ex
  136. +2 −1 lib/credo/code/interpolation_helper.ex
  137. +10 −0 lib/credo/code/scope.ex
  138. +4 −3 lib/credo/code/sigils.ex
  139. +2 −2 lib/credo/code/strings.ex
  140. +1 −1 lib/credo/code/token.ex
  141. +10 −21 lib/credo/config_builder.ex
  142. +29 −10 lib/credo/config_file.ex
  143. +38 −15 lib/credo/execution.ex
  144. +1 −1 lib/credo/execution/{issues.ex → execution_issues.ex}
  145. +1 −1 lib/credo/execution/{source_files.ex → execution_source_files.ex}
  146. +53 −2 lib/credo/execution/{timing.ex → execution_timing.ex}
  147. +0 −55 lib/credo/execution/monitor.ex
  148. +55 −5 lib/credo/execution/process_definition.ex
  149. +60 −3 lib/credo/execution/task.ex
  150. +2 −0 lib/credo/execution/task/assign_exit_status_for_issues.ex
  151. +56 −0 lib/credo/execution/task/convert_cli_options_to_config.ex
  152. +2 −0 lib/credo/execution/task/determine_command.ex
  153. +2 −0 lib/credo/execution/task/parse_options.ex
  154. +2 −0 lib/credo/execution/task/require_requires.ex
  155. +2 −0 lib/credo/execution/task/run_command.ex
  156. +5 −3 lib/credo/execution/task/set_default_command.ex
  157. +2 −0 lib/credo/execution/task/use_colors.ex
  158. +2 −0 lib/credo/execution/task/validate_config.ex
  159. +2 −0 lib/credo/execution/task/validate_options.ex
  160. +9 −7 lib/credo/execution/task/write_debug_report.ex
  161. +17 −4 lib/credo/exs_loader.ex
  162. +1 −1 lib/credo/issue.ex
  163. +14 −7 lib/credo/issue_meta.ex
  164. +2 −8 lib/credo/main_process.ex
  165. +5 −7 lib/credo/priority.ex
  166. +25 −1 lib/credo/service/commands.ex
  167. +25 −16 lib/credo/service/ets_table_helper.ex
  168. +2 −0 lib/credo/service/source_file_ast.ex
  169. +2 −0 lib/credo/service/source_file_lines.ex
  170. +2 −0 lib/credo/service/source_file_scopes.ex
  171. +2 −0 lib/credo/service/source_file_source.ex
  172. +1 −5 lib/credo/severity.ex
  173. +22 −9 lib/credo/source_file.ex
  174. +31 −4 lib/credo/sources.ex
  175. +5 −2 mix.exs
  176. +5 −2 mix.lock
  177. +0 −322 test/credo/check/code_helper_test.exs
  178. +1 −1 test/credo/check/consistency/space_around_operators/collector_test.exs
  179. +12 −1 test/credo/check/consistency/space_around_operators_test.exs
  180. +1 −0 test/credo/check/consistency/space_in_parentheses_test.exs
  181. +4 −0 test/credo/check/design/alias_usage_test.exs
  182. +38 −0 test/credo/check/readability/alias_order_test.exs
  183. +9 −9 test/credo/check/readability/large_numbers_test.exs
  184. +33 −0 test/credo/check/readability/specs_test.exs
  185. +18 −9 test/credo/check/readability/string_sigils_test.exs
  186. +24 −5 test/credo/check/refactor/abc_size_test.exs
  187. +1 −1 test/credo/check/refactor/cyclomatic_complexity_test.exs
  188. +3 −0 test/credo/check/refactor/pipe_chain_start_test.exs
  189. +13 −0 test/credo/check/warning/operation_on_same_values_test.exs
  190. +2 −2 test/credo/code/interpolation_helper_test.exs
  191. +2 −2 test/credo/code/parameters_test.exs
  192. +317 −0 test/credo/code_test.exs
  193. +25 −12 test/credo/config_file_test.exs
  194. +29 −5 test/credo/exs_loader_test.exs
  195. +1 −1 test/credo/source_file_test.exs
  196. +41 −11 test/credo/sources_test.exs
  197. +14 −0 test/fixtures/custom-config.exs.malformed
  198. +1 −1 test/fixtures/file_exclusion/.credo.exs
  199. +7 −7 test/test_helper.exs
@@ -51,107 +51,97 @@
#
## Consistency Checks
#
{Credo.Check.Consistency.ExceptionNames},
{Credo.Check.Consistency.LineEndings},
{Credo.Check.Consistency.ParameterPatternMatching},
{Credo.Check.Consistency.SpaceAroundOperators},
{Credo.Check.Consistency.SpaceInParentheses},
{Credo.Check.Consistency.TabsOrSpaces},
{Credo.Check.Consistency.ExceptionNames, []},
{Credo.Check.Consistency.LineEndings, []},
{Credo.Check.Consistency.ParameterPatternMatching, []},
{Credo.Check.Consistency.SpaceAroundOperators, []},
{Credo.Check.Consistency.SpaceInParentheses, []},
{Credo.Check.Consistency.TabsOrSpaces, []},
#
## Design Checks
#
# You can customize the priority of any check
# Priority values are: `low, normal, high, higher`
#
{Credo.Check.Design.AliasUsage, priority: :low},
# For some checks, you can also set other parameters
#
# If you don't want the `setup` and `test` macro calls in ExUnit tests
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
#
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
{Credo.Check.Design.AliasUsage,
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
# You can also customize the exit_status of each check.
# If you don't want TODO comments to cause `mix credo` to fail, just
# set this value to 0 (zero).
#
{Credo.Check.Design.TagTODO, exit_status: 2},
{Credo.Check.Design.TagFIXME},
{Credo.Check.Design.TagTODO, [exit_status: 2]},
{Credo.Check.Design.TagFIXME, []},
#
## Readability Checks
#
{Credo.Check.Readability.AliasOrder},
{Credo.Check.Readability.FunctionNames},
{Credo.Check.Readability.LargeNumbers},
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 120},
{Credo.Check.Readability.ModuleAttributeNames},
{Credo.Check.Readability.ModuleDoc},
{Credo.Check.Readability.ModuleNames},
{Credo.Check.Readability.ParenthesesOnZeroArityDefs},
{Credo.Check.Readability.ParenthesesInCondition},
{Credo.Check.Readability.PredicateFunctionNames},
{Credo.Check.Readability.PreferImplicitTry},
{Credo.Check.Readability.RedundantBlankLines},
{Credo.Check.Readability.StringSigils},
{Credo.Check.Readability.TrailingBlankLine},
{Credo.Check.Readability.TrailingWhiteSpace},
{Credo.Check.Readability.VariableNames},
{Credo.Check.Readability.Semicolons},
{Credo.Check.Readability.SpaceAfterCommas},
{Credo.Check.Readability.AliasOrder, []},
{Credo.Check.Readability.FunctionNames, []},
{Credo.Check.Readability.LargeNumbers, []},
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
{Credo.Check.Readability.ModuleAttributeNames, []},
{Credo.Check.Readability.ModuleDoc, []},
{Credo.Check.Readability.ModuleNames, []},
{Credo.Check.Readability.ParenthesesInCondition, []},
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
{Credo.Check.Readability.PredicateFunctionNames, []},
{Credo.Check.Readability.PreferImplicitTry, []},
{Credo.Check.Readability.RedundantBlankLines, []},
{Credo.Check.Readability.Semicolons, []},
{Credo.Check.Readability.SpaceAfterCommas, []},
{Credo.Check.Readability.StringSigils, []},
{Credo.Check.Readability.TrailingBlankLine, []},
{Credo.Check.Readability.TrailingWhiteSpace, []},
{Credo.Check.Readability.VariableNames, []},
#
## Refactoring Opportunities
#
{Credo.Check.Refactor.DoubleBooleanNegation},
{Credo.Check.Refactor.CondStatements},
{Credo.Check.Refactor.CyclomaticComplexity},
{Credo.Check.Refactor.FunctionArity},
{Credo.Check.Refactor.LongQuoteBlocks},
{Credo.Check.Refactor.MapInto},
{Credo.Check.Refactor.MatchInCondition},
{Credo.Check.Refactor.NegatedConditionsInUnless},
{Credo.Check.Refactor.NegatedConditionsWithElse},
{Credo.Check.Refactor.Nesting},
{Credo.Check.Refactor.CondStatements, []},
{Credo.Check.Refactor.CyclomaticComplexity, []},
{Credo.Check.Refactor.FunctionArity, []},
{Credo.Check.Refactor.LongQuoteBlocks, []},
{Credo.Check.Refactor.MapInto, []},
{Credo.Check.Refactor.MatchInCondition, []},
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
{Credo.Check.Refactor.Nesting, []},
{Credo.Check.Refactor.PipeChainStart,
excluded_argument_types: [:atom, :binary, :fn, :keyword], excluded_functions: []},
{Credo.Check.Refactor.UnlessWithElse},
[excluded_argument_types: [:atom, :binary, :fn, :keyword], excluded_functions: []]},
{Credo.Check.Refactor.UnlessWithElse, []},
#
## Warnings
#
{Credo.Check.Warning.BoolOperationOnSameValues},
{Credo.Check.Warning.ExpensiveEmptyEnumCheck},
{Credo.Check.Warning.IExPry},
{Credo.Check.Warning.IoInspect},
{Credo.Check.Warning.LazyLogging},
{Credo.Check.Warning.OperationOnSameValues},
{Credo.Check.Warning.OperationWithConstantResult},
{Credo.Check.Warning.UnsafeToAtom},
{Credo.Check.Warning.UnusedEnumOperation},
{Credo.Check.Warning.UnusedFileOperation},
{Credo.Check.Warning.UnusedKeywordOperation},
{Credo.Check.Warning.UnusedListOperation},
{Credo.Check.Warning.UnusedPathOperation},
{Credo.Check.Warning.UnusedRegexOperation},
{Credo.Check.Warning.UnusedStringOperation},
{Credo.Check.Warning.UnusedTupleOperation},
{Credo.Check.Warning.RaiseInsideRescue},
{Credo.Check.Warning.BoolOperationOnSameValues, []},
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
{Credo.Check.Warning.IExPry, []},
{Credo.Check.Warning.IoInspect, []},
{Credo.Check.Warning.LazyLogging, []},
{Credo.Check.Warning.OperationOnSameValues, []},
{Credo.Check.Warning.OperationWithConstantResult, []},
{Credo.Check.Warning.RaiseInsideRescue, []},
{Credo.Check.Warning.UnusedEnumOperation, []},
{Credo.Check.Warning.UnusedFileOperation, []},
{Credo.Check.Warning.UnusedKeywordOperation, []},
{Credo.Check.Warning.UnusedListOperation, []},
{Credo.Check.Warning.UnusedPathOperation, []},
{Credo.Check.Warning.UnusedRegexOperation, []},
{Credo.Check.Warning.UnusedStringOperation, []},
{Credo.Check.Warning.UnusedTupleOperation, []},
#
# Controversial and experimental checks (opt-in, just remove `, false`)
#
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
{Credo.Check.Design.DuplicatedCode, false},
{Credo.Check.Readability.Specs, false},
{Credo.Check.Refactor.ABCSize, false},
{Credo.Check.Refactor.AppendSingleItem, false},
{Credo.Check.Refactor.DoubleBooleanNegation, false},
{Credo.Check.Refactor.VariableRebinding, false},
{Credo.Check.Warning.MapGetUnsafePass, false},
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
#
# Deprecated checks (these will be deleted after a grace period)
#
{Credo.Check.Readability.Specs, false}
{Credo.Check.Warning.MapGetUnsafePass, false}
#
# Custom checks can be created using `mix credo.gen.check`.
@@ -1,2 +1,2 @@
erlang 20.3
elixir 1.7.1
elixir 1.7.3
@@ -3,11 +3,13 @@ language: elixir
elixir:
- 1.4.5
- 1.5.3
- 1.6.4
- 1.6.6
- 1.7.2
otp_release:
- 18.3
- 19.3
- 20.3
- 21.0
script:
- mix deps.compile
- mix compile --warnings-as-errors
@@ -17,6 +19,14 @@ script:
after_script:
- MIX_ENV=test mix inch.report
matrix:
allow_failures:
- elixir: 1.4.5
exclude:
- elixir: 1.6.1
- elixir: 1.6.6
otp_release: 18.3
- elixir: 1.7.2
otp_release: 18.3
- elixir: 1.4.5
otp_release: 21.0
- elixir: 1.5.3
otp_release: 21.0
@@ -1,5 +1,35 @@
# Changelog
## 1.0.0-rc1
- Improve documentation
- Add error handling for malformed config files
- Write all warnings to `:stderr`
- Fix false positive for charlists in PipeChainStart
- Remove deprecated --one-line switch
- Deactivate checks `DuplicatedCode` and `DoubleBooleanNegation` by default
### BREAKING CHANGES
These changes concern people writing their own checks for Credo.
- `Credo.Check.CodeHelper` was removed. Please use the corresponding functions inside the `Credo.Code` namespace.
## 0.10.2
- Fix bug in AliasOrder
## 0.10.1
- Fixed "unnecessary atom quotes" compiler warning during analysis
- Handle timeouts when reading source files
- Ignore function calls for OperationOnSameValues
- Do not treat `|>` as an operator in SpaceAroundOperators
- Fix AliasOrder bug for multi alias statements
- Fix multiple false positives for SpaceAroundOperators
- ... and lots of important little fixes to issue messages, docs and the like!
## 0.10.0
- Switch `poison` for `jason`
@@ -1,12 +1,12 @@
# Credo [![Build Status](https://travis-ci.org/rrrene/credo.svg?branch=master)](https://travis-ci.org/rrrene/credo) [![Deps Status](https://beta.hexfaktor.org/badge/all/github/rrrene/credo.svg?branch=master)](https://beta.hexfaktor.org/github/rrrene/credo) [![Inline docs](https://inch-ci.org/github/rrrene/credo.svg?branch=master)](https://inch-ci.org/github/rrrene/credo) [![Hex Version](https://img.shields.io/hexpm/v/credo.svg)](https://hex.pm/packages/credo) [![ElixirWeekly](https://img.shields.io/badge/featured-ElixirWeekly-a054ff.svg)](https://elixirweekly.net)
# Credo [![Build Status](https://travis-ci.org/rrrene/credo.svg?branch=master)](https://travis-ci.org/rrrene/credo) [![Inline docs](https://inch-ci.org/github/rrrene/credo.svg?branch=master)](https://inch-ci.org/github/rrrene/credo) [![Hex Version](https://img.shields.io/hexpm/v/credo.svg)](https://hex.pm/packages/credo) [![ElixirWeekly](https://img.shields.io/badge/featured-ElixirWeekly-a054ff.svg)](https://elixirweekly.net)
Credo is a static code analysis tool for the Elixir language with a focus on teaching and code consistency.
It implements [its own style guide](https://github.com/rrrene/elixir-style-guide).
## What can it do?
`credo` can show you refactoring opportunities in your code, complex and duplicated code fragments, warn you about common mistakes, show inconsistencies in your naming scheme and - if needed - help you enforce a desired coding style.
`credo` can show you refactoring opportunities in your code, complex code fragments, warn you about common mistakes, show inconsistencies in your naming scheme and - if needed - help you enforce a desired coding style.
If you are a Rubyist it is best described as an opinionated mix between [Inch](https://github.com/rrrene/inch) and [Rubocop](https://github.com/bbatsov/rubocop).
@@ -283,6 +283,15 @@ There are no additional options.
There are no additional options.
### info
`info` shows you information relevant to investigating errors and submitting bug reports.
Example usage:
$ mix credo info
$ mix credo info --verbose
$ mix credo info --verbose --format=json
## Command line options
@@ -429,11 +438,19 @@ While refactor checks show you possible problems, these checks try to highlight
These checks warn you about things that are potentially dangerous, like a missed call to `IEx.pry` or a call to `String.downcase` without saving the result.
## IDE/Editor Integrations
## Integrations
Some IDEs and editors are able to run `mix credo` in the background and mark and issues directly in the editor view.
### IDE/Editor
Some IDEs and editors are able to run Credo in the background and mark issues inline.
* [IntelliJ Elixir](https://github.com/KronicDeth/intellij-elixir#credo) - Elixir plugin for JetBrains IDEs (IntelliJ IDEA, Rubymine, PHPStorm, PyCharm, etc)
* [linter-elixir-credo](https://atom.io/packages/linter-elixir-credo) - Package for Atom editor (by @smeevil)
### Automated Code Review
* [Codacy](https://www.codacy.com/) - checks your code from style to security, duplication, complexity, and also integrates with coverage.
* [Stickler CI](https://stickler-ci.com/) - checks your code for style and best practices across your entire stack.
## Contributing
@@ -1,4 +1,13 @@
defmodule Credo do
@moduledoc """
Credo builds upon four building blocks:
- `Credo.CLI` - everything related to the command line interface (CLI), which orchestrates the analysis
- `Credo.Execution` - a struct which is handed down the pipeline during analysis
- `Credo.Check` - the default Credo checks
- `Credo.Code` - all analysis tools used by Credo during analysis
"""
@version Mix.Project.config()[:version]
def version, do: @version
@@ -1,4 +1,6 @@
defmodule Credo.Application do
@moduledoc false
use Application
def start(_type, _args) do
@@ -1,7 +1,7 @@
defmodule Credo.Backports.Enum do
@moduledoc """
This module provides Enum functions which are not supported in all Elixir
versions supported by Credo.
This module provides functions from the `Enum` module which are not supported
in all Elixir versions supported by Credo.
"""
@doc """
Oops, something went wrong.

0 comments on commit af4c734

Please sign in to comment.