You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

164 lines
6.1 KiB

  1. # This file contains the configuration for Credo and you are probably reading
  2. # this after creating it with `mix credo.gen.config`.
  3. #
  4. # If you find anything wrong or unclear in this file, please report an
  5. # issue on GitHub: https://github.com/rrrene/credo/issues
  6. #
  7. %{
  8. #
  9. # You can have as many configs as you like in the `configs:` field.
  10. configs: [
  11. %{
  12. #
  13. # Run any exec using `mix credo -C <name>`. If no exec name is given
  14. # "default" is used.
  15. #
  16. name: "default",
  17. #
  18. # These are the files included in the analysis:
  19. files: %{
  20. #
  21. # You can give explicit globs or simply directories.
  22. # In the latter case `**/*.{ex,exs}` will be used.
  23. #
  24. included: ["lib/", "src/", "test/"],
  25. excluded: [~r"/_build/", ~r"/deps/", ~r"/js/"]
  26. },
  27. #
  28. # If you create your own checks, you must specify the source files for
  29. # them here, so they can be loaded by Credo before running the analysis.
  30. #
  31. requires: [],
  32. #
  33. # If you want to enforce a style guide and need a more traditional linting
  34. # experience, you can change `strict` to `true` below:
  35. #
  36. strict: false,
  37. #
  38. # If you want to use uncolored output by default, you can change `color`
  39. # to `false` below:
  40. #
  41. color: true,
  42. #
  43. # You can customize the parameters of any check by adding a second element
  44. # to the tuple.
  45. #
  46. # To disable a check put `false` as second element:
  47. #
  48. # {Credo.Check.Design.DuplicatedCode, false}
  49. #
  50. checks: [
  51. #
  52. ## Consistency Checks
  53. #
  54. {Credo.Check.Consistency.ExceptionNames, []},
  55. {Credo.Check.Consistency.LineEndings, []},
  56. {Credo.Check.Consistency.ParameterPatternMatching, []},
  57. {Credo.Check.Consistency.SpaceAroundOperators, []},
  58. {Credo.Check.Consistency.SpaceInParentheses, []},
  59. {Credo.Check.Consistency.TabsOrSpaces, []},
  60. #
  61. ## Design Checks
  62. #
  63. # You can customize the priority of any check
  64. # Priority values are: `low, normal, high, higher`
  65. #
  66. {Credo.Check.Design.AliasUsage,
  67. [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
  68. # You can also customize the exit_status of each check.
  69. # If you don't want TODO comments to cause `mix credo` to fail, just
  70. # set this value to 0 (zero).
  71. #
  72. {Credo.Check.Design.TagTODO, [exit_status: 0]},
  73. {Credo.Check.Design.TagFIXME, []},
  74. #
  75. ## Readability Checks
  76. #
  77. {Credo.Check.Readability.AliasOrder, []},
  78. {Credo.Check.Readability.FunctionNames, []},
  79. {Credo.Check.Readability.LargeNumbers, []},
  80. {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
  81. {Credo.Check.Readability.ModuleAttributeNames, []},
  82. {Credo.Check.Readability.ModuleDoc, []},
  83. {Credo.Check.Readability.ModuleNames, []},
  84. {Credo.Check.Readability.ParenthesesInCondition, []},
  85. {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
  86. {Credo.Check.Readability.PredicateFunctionNames, []},
  87. {Credo.Check.Readability.PreferImplicitTry, []},
  88. {Credo.Check.Readability.RedundantBlankLines, []},
  89. {Credo.Check.Readability.Semicolons, []},
  90. {Credo.Check.Readability.SpaceAfterCommas, []},
  91. {Credo.Check.Readability.StringSigils, []},
  92. {Credo.Check.Readability.TrailingBlankLine, []},
  93. {Credo.Check.Readability.TrailingWhiteSpace, []},
  94. {Credo.Check.Readability.VariableNames, []},
  95. #
  96. ## Refactoring Opportunities
  97. #
  98. {Credo.Check.Refactor.CondStatements, []},
  99. {Credo.Check.Refactor.CyclomaticComplexity, []},
  100. {Credo.Check.Refactor.FunctionArity, [max_arity: 9]},
  101. {Credo.Check.Refactor.LongQuoteBlocks, []},
  102. {Credo.Check.Refactor.MatchInCondition, []},
  103. {Credo.Check.Refactor.NegatedConditionsInUnless, []},
  104. {Credo.Check.Refactor.NegatedConditionsWithElse, []},
  105. {Credo.Check.Refactor.Nesting, [
  106. max_nesting: 3
  107. ]},
  108. {Credo.Check.Refactor.PipeChainStart,
  109. [
  110. excluded_argument_types: [:atom, :binary, :fn, :keyword, :number],
  111. excluded_functions: []
  112. ]},
  113. {Credo.Check.Refactor.UnlessWithElse, []},
  114. #
  115. ## Warnings
  116. #
  117. {Credo.Check.Warning.ApplicationConfigInModuleAttribute, false},
  118. {Credo.Check.Warning.BoolOperationOnSameValues, []},
  119. {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
  120. {Credo.Check.Warning.IExPry, []},
  121. {Credo.Check.Warning.IoInspect, []},
  122. {Credo.Check.Warning.OperationOnSameValues, []},
  123. {Credo.Check.Warning.OperationWithConstantResult, []},
  124. {Credo.Check.Warning.RaiseInsideRescue, []},
  125. {Credo.Check.Warning.UnusedEnumOperation, []},
  126. {Credo.Check.Warning.UnusedFileOperation, []},
  127. {Credo.Check.Warning.UnusedKeywordOperation, []},
  128. {Credo.Check.Warning.UnusedListOperation, []},
  129. {Credo.Check.Warning.UnusedPathOperation, []},
  130. {Credo.Check.Warning.UnusedRegexOperation, []},
  131. {Credo.Check.Warning.UnusedStringOperation, []},
  132. {Credo.Check.Warning.UnusedTupleOperation, []},
  133. #
  134. # Controversial and experimental checks (opt-in, just remove `, false`)
  135. #
  136. {Credo.Check.Consistency.MultiAliasImportRequireUse, false},
  137. {Credo.Check.Design.DuplicatedCode, false},
  138. {Credo.Check.Readability.Specs, false},
  139. {Credo.Check.Refactor.ABCSize, false},
  140. {Credo.Check.Refactor.AppendSingleItem, false},
  141. {Credo.Check.Refactor.DoubleBooleanNegation, false},
  142. {Credo.Check.Refactor.VariableRebinding, false},
  143. {Credo.Check.Warning.MapGetUnsafePass, false},
  144. {Credo.Check.Warning.UnsafeToAtom, false},
  145. #
  146. # Custom checks can be created using `mix credo.gen.check`.
  147. #
  148. #
  149. # Removed checks
  150. #
  151. {Credo.Check.Warning.LazyLogging, false},
  152. {Credo.Check.Refactor.MapInto, false},
  153. ]
  154. }
  155. ]
  156. }