1 # This file contains the configuration for Credo and you are probably reading
2 # this after creating it with `mix credo.gen.config`.
4 # If you find anything wrong or unclear in this file, please report an
5 # issue on GitHub: https://github.com/rrrene/credo/issues
9 # You can have as many configs as you like in the `configs:` field.
13 # Run any config using `mix credo -C <name>`. If no config name is given
17 # These are the files included in the analysis:
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/"]
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: ["./test/credo/check/consistency/file_location.ex"],
30 # Credo automatically checks for updates, like e.g. Hex does.
31 # You can disable this behaviour below:
32 check_for_updates: true,
34 # If you want to enforce a style guide and need a more traditional linting
35 # experience, you can change `strict` to `true` below:
38 # If you want to use uncolored output by default, you can change `color`
42 # You can customize the parameters of any check by adding a second element
45 # To disable a check put `false` as second element:
47 # {Credo.Check.Design.DuplicatedCode, false}
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},
58 # For some checks, like AliasUsage, you can only customize the priority
59 # Priority values are: `low, normal, high, higher`
60 {Credo.Check.Design.AliasUsage, priority: :low, if_called_more_often_than: 3},
62 # For others you can set parameters
64 # If you don't want the `setup` and `test` macro calls in ExUnit tests
65 # or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
66 # set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
67 {Credo.Check.Design.DuplicatedCode, excluded_macros: []},
69 # You can also customize the exit_status of each check.
70 # If you don't want TODO comments to cause `mix credo` to fail, just
71 # set this value to 0 (zero).
72 {Credo.Check.Design.TagTODO, exit_status: 0},
73 {Credo.Check.Design.TagFIXME, exit_status: 0},
74 {Credo.Check.Readability.FunctionNames},
75 {Credo.Check.Readability.LargeNumbers},
76 {Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 100},
77 {Credo.Check.Readability.ModuleAttributeNames},
78 {Credo.Check.Readability.ModuleDoc, false},
79 {Credo.Check.Readability.ModuleNames},
80 {Credo.Check.Readability.ParenthesesOnZeroArityDefs},
81 {Credo.Check.Readability.ParenthesesInCondition},
82 {Credo.Check.Readability.PredicateFunctionNames},
83 # lanodan: I think PreferImplicitTry should be consistency, and the behaviour seems
84 # inconsistent, see: https://github.com/rrrene/credo/issues/224
85 {Credo.Check.Readability.PreferImplicitTry, false},
86 {Credo.Check.Readability.RedundantBlankLines},
87 {Credo.Check.Readability.StringSigils},
88 {Credo.Check.Readability.TrailingBlankLine},
89 {Credo.Check.Readability.TrailingWhiteSpace},
90 {Credo.Check.Readability.VariableNames},
91 {Credo.Check.Readability.Semicolons},
92 {Credo.Check.Readability.SpaceAfterCommas},
93 {Credo.Check.Refactor.DoubleBooleanNegation},
94 {Credo.Check.Refactor.CondStatements},
95 {Credo.Check.Refactor.CyclomaticComplexity},
96 {Credo.Check.Refactor.FunctionArity},
97 {Credo.Check.Refactor.MatchInCondition},
98 {Credo.Check.Refactor.NegatedConditionsInUnless},
99 {Credo.Check.Refactor.NegatedConditionsWithElse},
100 {Credo.Check.Refactor.Nesting},
101 {Credo.Check.Refactor.PipeChainStart},
102 {Credo.Check.Refactor.UnlessWithElse},
103 {Credo.Check.Warning.BoolOperationOnSameValues},
104 {Credo.Check.Warning.IExPry},
105 {Credo.Check.Warning.IoInspect},
106 # Got too much of them, not sure if relevant
107 {Credo.Check.Warning.LazyLogging, false},
108 {Credo.Check.Warning.OperationOnSameValues},
109 {Credo.Check.Warning.OperationWithConstantResult},
110 {Credo.Check.Warning.UnusedEnumOperation},
111 {Credo.Check.Warning.UnusedFileOperation},
112 {Credo.Check.Warning.UnusedKeywordOperation},
113 {Credo.Check.Warning.UnusedListOperation},
114 {Credo.Check.Warning.UnusedPathOperation},
115 {Credo.Check.Warning.UnusedRegexOperation},
116 {Credo.Check.Warning.UnusedStringOperation},
117 {Credo.Check.Warning.UnusedTupleOperation},
119 # Controversial and experimental checks (opt-in, just remove `, false`)
121 {Credo.Check.Refactor.ABCSize, false},
122 {Credo.Check.Refactor.AppendSingleItem, false},
123 {Credo.Check.Refactor.VariableRebinding, false},
124 {Credo.Check.Warning.MapGetUnsafePass, false},
126 # Deprecated checks (these will be deleted after a grace period)
127 {Credo.Check.Readability.Specs, false},
129 # Custom checks can be created using `mix credo.gen.check`.
131 {Credo.Check.Consistency.FileLocation}