.credo.exs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 config using `mix credo -C <name>`. If no config name is given
  14. # "default" is used.
  15. name: "default",
  16. #
  17. # These are the files included in the analysis:
  18. files: %{
  19. #
  20. # You can give explicit globs or simply directories.
  21. # In the latter case `**/*.{ex,exs}` will be used.
  22. included: ["lib/", "src/", "web/", "apps/", "test/"],
  23. excluded: [~r"/_build/", ~r"/deps/"]
  24. },
  25. #
  26. # If you create your own checks, you must specify the source files for
  27. # them here, so they can be loaded by Credo before running the analysis.
  28. requires: [],
  29. #
  30. # Credo automatically checks for updates, like e.g. Hex does.
  31. # You can disable this behaviour below:
  32. check_for_updates: true,
  33. #
  34. # If you want to enforce a style guide and need a more traditional linting
  35. # experience, you can change `strict` to `true` below:
  36. strict: false,
  37. #
  38. # If you want to use uncolored output by default, you can change `color`
  39. # to `false` below:
  40. color: true,
  41. #
  42. # You can customize the parameters of any check by adding a second element
  43. # to the tuple.
  44. #
  45. # To disable a check put `false` as second element:
  46. #
  47. # {Credo.Check.Design.DuplicatedCode, false}
  48. #
  49. checks: [
  50. {Credo.Check.Consistency.ExceptionNames},
  51. {Credo.Check.Consistency.LineEndings},
  52. {Credo.Check.Consistency.MultiAliasImportRequireUse},
  53. {Credo.Check.Consistency.ParameterPatternMatching},
  54. {Credo.Check.Consistency.SpaceAroundOperators},
  55. {Credo.Check.Consistency.SpaceInParentheses},
  56. {Credo.Check.Consistency.TabsOrSpaces},
  57. # For some checks, like AliasUsage, you can only customize the priority
  58. # Priority values are: `low, normal, high, higher`
  59. {Credo.Check.Design.AliasUsage, priority: :low, if_called_more_often_than: 3},
  60. # For others you can set parameters
  61. # If you don't want the `setup` and `test` macro calls in ExUnit tests
  62. # or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
  63. # set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
  64. {Credo.Check.Design.DuplicatedCode, excluded_macros: []},
  65. # You can also customize the exit_status of each check.
  66. # If you don't want TODO comments to cause `mix credo` to fail, just
  67. # set this value to 0 (zero).
  68. {Credo.Check.Design.TagTODO, exit_status: 0},
  69. {Credo.Check.Design.TagFIXME, exit_status: 0},
  70. {Credo.Check.Readability.FunctionNames},
  71. {Credo.Check.Readability.LargeNumbers},
  72. {Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 100},
  73. {Credo.Check.Readability.ModuleAttributeNames},
  74. {Credo.Check.Readability.ModuleDoc, false},
  75. {Credo.Check.Readability.ModuleNames},
  76. {Credo.Check.Readability.ParenthesesOnZeroArityDefs},
  77. {Credo.Check.Readability.ParenthesesInCondition},
  78. {Credo.Check.Readability.PredicateFunctionNames},
  79. # lanodan: I think PreferImplicitTry should be consistency, and the behaviour seems
  80. # inconsistent, see: https://github.com/rrrene/credo/issues/224
  81. {Credo.Check.Readability.PreferImplicitTry, false},
  82. {Credo.Check.Readability.RedundantBlankLines},
  83. {Credo.Check.Readability.StringSigils},
  84. {Credo.Check.Readability.TrailingBlankLine},
  85. {Credo.Check.Readability.TrailingWhiteSpace},
  86. {Credo.Check.Readability.VariableNames},
  87. {Credo.Check.Readability.Semicolons},
  88. {Credo.Check.Readability.SpaceAfterCommas},
  89. {Credo.Check.Refactor.DoubleBooleanNegation},
  90. {Credo.Check.Refactor.CondStatements},
  91. {Credo.Check.Refactor.CyclomaticComplexity},
  92. {Credo.Check.Refactor.FunctionArity},
  93. {Credo.Check.Refactor.MatchInCondition},
  94. {Credo.Check.Refactor.NegatedConditionsInUnless},
  95. {Credo.Check.Refactor.NegatedConditionsWithElse},
  96. {Credo.Check.Refactor.Nesting},
  97. {Credo.Check.Refactor.PipeChainStart},
  98. {Credo.Check.Refactor.UnlessWithElse},
  99. {Credo.Check.Warning.BoolOperationOnSameValues},
  100. {Credo.Check.Warning.IExPry},
  101. {Credo.Check.Warning.IoInspect},
  102. # Got too much of them, not sure if relevant
  103. {Credo.Check.Warning.LazyLogging, false},
  104. {Credo.Check.Warning.OperationOnSameValues},
  105. {Credo.Check.Warning.OperationWithConstantResult},
  106. {Credo.Check.Warning.UnusedEnumOperation},
  107. {Credo.Check.Warning.UnusedFileOperation},
  108. {Credo.Check.Warning.UnusedKeywordOperation},
  109. {Credo.Check.Warning.UnusedListOperation},
  110. {Credo.Check.Warning.UnusedPathOperation},
  111. {Credo.Check.Warning.UnusedRegexOperation},
  112. {Credo.Check.Warning.UnusedStringOperation},
  113. {Credo.Check.Warning.UnusedTupleOperation},
  114. # Controversial and experimental checks (opt-in, just remove `, false`)
  115. #
  116. {Credo.Check.Refactor.ABCSize, false},
  117. {Credo.Check.Refactor.AppendSingleItem, false},
  118. {Credo.Check.Refactor.VariableRebinding, false},
  119. {Credo.Check.Warning.MapGetUnsafePass, false},
  120. # Deprecated checks (these will be deleted after a grace period)
  121. {Credo.Check.Readability.Specs, false},
  122. # Custom checks can be created using `mix credo.gen.check`.
  123. #
  124. ]
  125. }
  126. ]
  127. }