|
10 | 10 | configs: [ |
11 | 11 | %{ |
12 | 12 | # |
13 | | - # Run any exec using `mix credo -C <name>`. If no exec name is given |
| 13 | + # Run any config using `mix credo -C <name>`. If no config name is given |
14 | 14 | # "default" is used. |
15 | 15 | # |
16 | 16 | name: "default", |
|
20 | 20 | # |
21 | 21 | # You can give explicit globs or simply directories. |
22 | 22 | # In the latter case `**/*.{ex,exs}` will be used. |
23 | | - # |
24 | | - included: ["lib/", "src/", "web/", "apps/"], |
| 23 | + # |
| 24 | + included: ["lib/", "test/"], |
25 | 25 | excluded: [~r"/_build/", ~r"/deps/"] |
26 | 26 | }, |
27 | 27 | # |
| 28 | + # Load and configure plugins here: |
| 29 | + # |
| 30 | + plugins: [], |
| 31 | + # |
28 | 32 | # If you create your own checks, you must specify the source files for |
29 | 33 | # them here, so they can be loaded by Credo before running the analysis. |
30 | 34 | # |
|
35 | 39 | # |
36 | 40 | strict: true, |
37 | 41 | # |
| 42 | + # To modify the timeout for parsing files, change this value: |
| 43 | + # |
| 44 | + parse_timeout: 5000, |
| 45 | + # |
38 | 46 | # If you want to use uncolored output by default, you can change `color` |
39 | 47 | # to `false` below: |
40 | 48 | # |
|
48 | 56 | # {Credo.Check.Design.DuplicatedCode, false} |
49 | 57 | # |
50 | 58 | checks: [ |
51 | | - {Credo.Check.Consistency.ExceptionNames}, |
52 | | - {Credo.Check.Consistency.LineEndings}, |
53 | | - {Credo.Check.Consistency.ParameterPatternMatching}, |
54 | | - {Credo.Check.Consistency.SpaceAroundOperators}, |
55 | | - {Credo.Check.Consistency.SpaceInParentheses}, |
56 | | - {Credo.Check.Consistency.TabsOrSpaces}, |
57 | | - |
58 | | - # You can customize the priority of any check |
59 | | - # Priority values are: `low, normal, high, higher` |
60 | 59 | # |
61 | | - {Credo.Check.Design.AliasUsage, priority: :low}, |
| 60 | + ## Consistency Checks |
| 61 | + # |
| 62 | + {Credo.Check.Consistency.ExceptionNames, []}, |
| 63 | + {Credo.Check.Consistency.LineEndings, []}, |
| 64 | + {Credo.Check.Consistency.ParameterPatternMatching, []}, |
| 65 | + {Credo.Check.Consistency.SpaceAroundOperators, []}, |
| 66 | + {Credo.Check.Consistency.SpaceInParentheses, []}, |
| 67 | + {Credo.Check.Consistency.TabsOrSpaces, []}, |
62 | 68 |
|
63 | | - # For some checks, you can also set other parameters |
64 | 69 | # |
65 | | - # If you don't want the `setup` and `test` macro calls in ExUnit tests |
66 | | - # or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just |
67 | | - # set the `excluded_macros` parameter to `[:schema, :setup, :test]`. |
| 70 | + ## Design Checks |
68 | 71 | # |
69 | | - {Credo.Check.Design.DuplicatedCode, excluded_macros: []}, |
70 | | - |
| 72 | + # You can customize the priority of any check |
| 73 | + # Priority values are: `low, normal, high, higher` |
| 74 | + # |
| 75 | + {Credo.Check.Design.AliasUsage, |
| 76 | + [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]}, |
71 | 77 | # You can also customize the exit_status of each check. |
72 | 78 | # If you don't want TODO comments to cause `mix credo` to fail, just |
73 | 79 | # set this value to 0 (zero). |
74 | 80 | # |
75 | | - {Credo.Check.Design.TagTODO, exit_status: 2}, |
76 | | - {Credo.Check.Design.TagFIXME}, |
| 81 | + {Credo.Check.Design.TagTODO, [exit_status: 0]}, |
| 82 | + # TODO: Reenable error exit status |
| 83 | + # {Credo.Check.Design.TagTODO, [exit_status: 2]}, |
| 84 | + {Credo.Check.Design.TagFIXME, []}, |
77 | 85 |
|
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.ParenthesesOnZeroArityDefs}, |
85 | | - {Credo.Check.Readability.ParenthesesInCondition}, |
86 | | - {Credo.Check.Readability.PredicateFunctionNames}, |
87 | | - {Credo.Check.Readability.PreferImplicitTry}, |
88 | | - {Credo.Check.Readability.RedundantBlankLines}, |
89 | | - {Credo.Check.Readability.StringSigils}, |
90 | | - {Credo.Check.Readability.TrailingBlankLine}, |
91 | | - {Credo.Check.Readability.TrailingWhiteSpace}, |
92 | | - {Credo.Check.Readability.VariableNames}, |
93 | | - {Credo.Check.Readability.Semicolons}, |
94 | | - {Credo.Check.Readability.SpaceAfterCommas}, |
| 86 | + # |
| 87 | + ## Readability Checks |
| 88 | + # |
| 89 | + {Credo.Check.Readability.AliasOrder, []}, |
| 90 | + {Credo.Check.Readability.FunctionNames, []}, |
| 91 | + {Credo.Check.Readability.LargeNumbers, []}, |
| 92 | + {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]}, |
| 93 | + {Credo.Check.Readability.ModuleAttributeNames, []}, |
| 94 | + {Credo.Check.Readability.ModuleDoc, []}, |
| 95 | + {Credo.Check.Readability.ModuleNames, []}, |
| 96 | + {Credo.Check.Readability.ParenthesesInCondition, []}, |
| 97 | + {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, |
| 98 | + {Credo.Check.Readability.PredicateFunctionNames, []}, |
| 99 | + {Credo.Check.Readability.PreferImplicitTry, []}, |
| 100 | + {Credo.Check.Readability.RedundantBlankLines, []}, |
| 101 | + {Credo.Check.Readability.Semicolons, []}, |
| 102 | + {Credo.Check.Readability.SpaceAfterCommas, []}, |
| 103 | + {Credo.Check.Readability.StringSigils, []}, |
| 104 | + {Credo.Check.Readability.TrailingBlankLine, []}, |
| 105 | + {Credo.Check.Readability.TrailingWhiteSpace, []}, |
| 106 | + {Credo.Check.Readability.UnnecessaryAliasExpansion, []}, |
| 107 | + {Credo.Check.Readability.VariableNames, []}, |
95 | 108 |
|
96 | | - {Credo.Check.Refactor.DoubleBooleanNegation}, |
97 | | - {Credo.Check.Refactor.CondStatements}, |
98 | | - {Credo.Check.Refactor.CyclomaticComplexity}, |
99 | | - {Credo.Check.Refactor.FunctionArity, max_arity: 7}, |
100 | | - {Credo.Check.Refactor.LongQuoteBlocks}, |
101 | | - {Credo.Check.Refactor.MatchInCondition}, |
102 | | - {Credo.Check.Refactor.NegatedConditionsInUnless}, |
103 | | - {Credo.Check.Refactor.NegatedConditionsWithElse}, |
104 | | - {Credo.Check.Refactor.Nesting}, |
105 | | - {Credo.Check.Refactor.PipeChainStart}, |
106 | | - {Credo.Check.Refactor.UnlessWithElse}, |
| 109 | + # |
| 110 | + ## Refactoring Opportunities |
| 111 | + # |
| 112 | + {Credo.Check.Refactor.CondStatements, []}, |
| 113 | + {Credo.Check.Refactor.CyclomaticComplexity, []}, |
| 114 | + {Credo.Check.Refactor.FunctionArity, []}, |
| 115 | + {Credo.Check.Refactor.LongQuoteBlocks, []}, |
| 116 | + # {Credo.Check.Refactor.MapInto, []}, |
| 117 | + {Credo.Check.Refactor.MatchInCondition, []}, |
| 118 | + {Credo.Check.Refactor.NegatedConditionsInUnless, []}, |
| 119 | + {Credo.Check.Refactor.NegatedConditionsWithElse, []}, |
| 120 | + {Credo.Check.Refactor.Nesting, []}, |
| 121 | + {Credo.Check.Refactor.UnlessWithElse, []}, |
| 122 | + {Credo.Check.Refactor.WithClauses, []}, |
| 123 | + |
| 124 | + # |
| 125 | + ## Warnings |
| 126 | + # |
| 127 | + {Credo.Check.Warning.ApplicationConfigInModuleAttribute, []}, |
| 128 | + {Credo.Check.Warning.BoolOperationOnSameValues, []}, |
| 129 | + {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, |
| 130 | + {Credo.Check.Warning.IExPry, []}, |
| 131 | + {Credo.Check.Warning.IoInspect, []}, |
| 132 | + # {Credo.Check.Warning.LazyLogging, []}, |
| 133 | + {Credo.Check.Warning.MixEnv, false}, |
| 134 | + {Credo.Check.Warning.OperationOnSameValues, []}, |
| 135 | + {Credo.Check.Warning.OperationWithConstantResult, []}, |
| 136 | + {Credo.Check.Warning.RaiseInsideRescue, []}, |
| 137 | + {Credo.Check.Warning.UnusedEnumOperation, []}, |
| 138 | + {Credo.Check.Warning.UnusedFileOperation, []}, |
| 139 | + {Credo.Check.Warning.UnusedKeywordOperation, []}, |
| 140 | + {Credo.Check.Warning.UnusedListOperation, []}, |
| 141 | + {Credo.Check.Warning.UnusedPathOperation, []}, |
| 142 | + {Credo.Check.Warning.UnusedRegexOperation, []}, |
| 143 | + {Credo.Check.Warning.UnusedStringOperation, []}, |
| 144 | + {Credo.Check.Warning.UnusedTupleOperation, []}, |
| 145 | + {Credo.Check.Warning.UnsafeExec, []}, |
107 | 146 |
|
108 | | - {Credo.Check.Warning.BoolOperationOnSameValues}, |
109 | | - {Credo.Check.Warning.ExpensiveEmptyEnumCheck}, |
110 | | - {Credo.Check.Warning.IExPry}, |
111 | | - {Credo.Check.Warning.IoInspect}, |
112 | | - {Credo.Check.Warning.LazyLogging}, |
113 | | - {Credo.Check.Warning.OperationOnSameValues}, |
114 | | - {Credo.Check.Warning.OperationWithConstantResult}, |
115 | | - {Credo.Check.Warning.UnusedEnumOperation}, |
116 | | - {Credo.Check.Warning.UnusedFileOperation}, |
117 | | - {Credo.Check.Warning.UnusedKeywordOperation}, |
118 | | - {Credo.Check.Warning.UnusedListOperation}, |
119 | | - {Credo.Check.Warning.UnusedPathOperation}, |
120 | | - {Credo.Check.Warning.UnusedRegexOperation}, |
121 | | - {Credo.Check.Warning.UnusedStringOperation}, |
122 | | - {Credo.Check.Warning.UnusedTupleOperation}, |
123 | | - {Credo.Check.Warning.RaiseInsideRescue}, |
| 147 | + # |
| 148 | + # Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`) |
124 | 149 |
|
125 | | - # Controversial and experimental checks (opt-in, just remove `, false`) |
126 | 150 | # |
| 151 | + # Controversial and experimental checks (opt-in, just replace `false` with `[]`) |
| 152 | + # |
| 153 | + {Credo.Check.Consistency.MultiAliasImportRequireUse, false}, |
| 154 | + {Credo.Check.Consistency.UnusedVariableNames, false}, |
| 155 | + {Credo.Check.Design.DuplicatedCode, false}, |
| 156 | + {Credo.Check.Readability.AliasAs, false}, |
| 157 | + {Credo.Check.Readability.BlockPipe, false}, |
| 158 | + {Credo.Check.Readability.ImplTrue, false}, |
| 159 | + {Credo.Check.Readability.MultiAlias, false}, |
| 160 | + {Credo.Check.Readability.SeparateAliasRequire, false}, |
| 161 | + {Credo.Check.Readability.SinglePipe, false}, |
| 162 | + {Credo.Check.Readability.Specs, false}, |
| 163 | + {Credo.Check.Readability.StrictModuleLayout, false}, |
| 164 | + {Credo.Check.Readability.WithCustomTaggedTuple, false}, |
127 | 165 | {Credo.Check.Refactor.ABCSize, false}, |
128 | 166 | {Credo.Check.Refactor.AppendSingleItem, false}, |
| 167 | + {Credo.Check.Refactor.DoubleBooleanNegation, false}, |
| 168 | + {Credo.Check.Refactor.ModuleDependencies, false}, |
| 169 | + {Credo.Check.Refactor.NegatedIsNil, false}, |
| 170 | + {Credo.Check.Refactor.PipeChainStart, false}, |
129 | 171 | {Credo.Check.Refactor.VariableRebinding, false}, |
| 172 | + {Credo.Check.Warning.LeakyEnvironment, false}, |
130 | 173 | {Credo.Check.Warning.MapGetUnsafePass, false}, |
131 | | - {Credo.Check.Consistency.MultiAliasImportRequireUse, false}, |
| 174 | + {Credo.Check.Warning.UnsafeToAtom, false} |
132 | 175 |
|
133 | | - # Deprecated checks (these will be deleted after a grace period) |
134 | 176 | # |
135 | | - {Credo.Check.Readability.Specs, false}, |
136 | | - {Credo.Check.Warning.NameRedeclarationByAssignment, false}, |
137 | | - {Credo.Check.Warning.NameRedeclarationByCase, false}, |
138 | | - {Credo.Check.Warning.NameRedeclarationByDef, false}, |
139 | | - {Credo.Check.Warning.NameRedeclarationByFn, false}, |
140 | | - |
141 | 177 | # Custom checks can be created using `mix credo.gen.check`. |
142 | 178 | # |
143 | 179 | ] |
|
0 commit comments