|
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 | name: "default", |
16 | 17 | # |
17 | 18 | # These are the files included in the analysis: |
18 | 19 | files: %{ |
19 | 20 | # |
20 | 21 | # You can give explicit globs or simply directories. |
21 | 22 | # In the latter case `**/*.{ex,exs}` will be used. |
22 | | - included: ["lib/", "src/", "web/", "apps/"], |
| 23 | + included: ["config/", "lib/", "test/"], |
23 | 24 | excluded: [~r"/_build/", ~r"/deps/"] |
24 | 25 | }, |
25 | 26 | # |
| 27 | + # Load and configure plugins here: |
| 28 | + # |
| 29 | + plugins: [], |
| 30 | + # |
26 | 31 | # If you create your own checks, you must specify the source files for |
27 | 32 | # them here, so they can be loaded by Credo before running the analysis. |
28 | | - requires: [], |
29 | 33 | # |
30 | | - # Credo automatically checks for updates, like e.g. Hex does. |
31 | | - # You can disable this behaviour below: |
32 | | - check_for_updates: true, |
| 34 | + requires: [], |
33 | 35 | # |
34 | 36 | # If you want to enforce a style guide and need a more traditional linting |
35 | 37 | # experience, you can change `strict` to `true` below: |
| 38 | + # |
36 | 39 | strict: false, |
37 | 40 | # |
| 41 | + # To modify the timeout for parsing files, change this value: |
| 42 | + # |
| 43 | + parse_timeout: 5000, |
| 44 | + # |
38 | 45 | # If you want to use uncolored output by default, you can change `color` |
39 | 46 | # to `false` below: |
| 47 | + # |
40 | 48 | color: true, |
41 | 49 | # |
42 | 50 | # You can customize the parameters of any check by adding a second element |
|
46 | 54 | # |
47 | 55 | # {Credo.Check.Design.DuplicatedCode, false} |
48 | 56 | # |
49 | | - checks: [ |
50 | | - # |
51 | | - ## Consistency Checks |
52 | | - # |
53 | | - {Credo.Check.Consistency.ExceptionNames, []}, |
54 | | - {Credo.Check.Consistency.LineEndings, []}, |
55 | | - {Credo.Check.Consistency.ParameterPatternMatching, []}, |
56 | | - {Credo.Check.Consistency.SpaceAroundOperators, []}, |
57 | | - {Credo.Check.Consistency.SpaceInParentheses, []}, |
58 | | - {Credo.Check.Consistency.TabsOrSpaces, []}, |
| 57 | + checks: %{ |
| 58 | + enabled: [ |
| 59 | + # |
| 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, []}, |
59 | 68 |
|
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: 1]}, |
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: 2]}, |
73 | | - {Credo.Check.Design.TagFIXME, []}, |
| 69 | + # |
| 70 | + ## Design Checks |
| 71 | + # |
| 72 | + # You can customize the priority of any check |
| 73 | + # Priority values are: `low, normal, high, higher` |
| 74 | + # |
| 75 | + {Credo.Check.Design.AliasUsage, [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]}, |
| 76 | + {Credo.Check.Design.TagFIXME, []}, |
| 77 | + # You can also customize the exit_status of each check. |
| 78 | + # If you don't want TODO comments to cause `mix credo` to fail, just |
| 79 | + # set this value to 0 (zero). |
| 80 | + # |
| 81 | + {Credo.Check.Design.TagTODO, [exit_status: 2]}, |
74 | 82 |
|
75 | | - # |
76 | | - ## Readability Checks |
77 | | - # |
78 | | - {Credo.Check.Readability.AliasOrder, []}, |
79 | | - {Credo.Check.Readability.FunctionNames, []}, |
80 | | - {Credo.Check.Readability.LargeNumbers, []}, |
81 | | - {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]}, |
82 | | - {Credo.Check.Readability.ModuleAttributeNames, []}, |
83 | | - {Credo.Check.Readability.ModuleDoc, []}, |
84 | | - {Credo.Check.Readability.ModuleNames, []}, |
85 | | - {Credo.Check.Readability.ParenthesesInCondition, []}, |
86 | | - {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, |
87 | | - {Credo.Check.Readability.PredicateFunctionNames, []}, |
88 | | - {Credo.Check.Readability.PreferImplicitTry, []}, |
89 | | - {Credo.Check.Readability.RedundantBlankLines, []}, |
90 | | - {Credo.Check.Readability.Semicolons, []}, |
91 | | - {Credo.Check.Readability.SpaceAfterCommas, []}, |
92 | | - {Credo.Check.Readability.StringSigils, []}, |
93 | | - {Credo.Check.Readability.TrailingBlankLine, []}, |
94 | | - {Credo.Check.Readability.TrailingWhiteSpace, []}, |
95 | | - {Credo.Check.Readability.VariableNames, []}, |
| 83 | + # |
| 84 | + ## Readability Checks |
| 85 | + # |
| 86 | + {Credo.Check.Readability.AliasOrder, []}, |
| 87 | + {Credo.Check.Readability.FunctionNames, []}, |
| 88 | + {Credo.Check.Readability.LargeNumbers, []}, |
| 89 | + {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]}, |
| 90 | + {Credo.Check.Readability.ModuleAttributeNames, []}, |
| 91 | + {Credo.Check.Readability.ModuleDoc, false}, |
| 92 | + {Credo.Check.Readability.ModuleNames, []}, |
| 93 | + {Credo.Check.Readability.ParenthesesInCondition, []}, |
| 94 | + {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, |
| 95 | + {Credo.Check.Readability.PipeIntoAnonymousFunctions, []}, |
| 96 | + {Credo.Check.Readability.PredicateFunctionNames, []}, |
| 97 | + {Credo.Check.Readability.PreferImplicitTry, []}, |
| 98 | + {Credo.Check.Readability.RedundantBlankLines, []}, |
| 99 | + {Credo.Check.Readability.Semicolons, []}, |
| 100 | + {Credo.Check.Readability.SpaceAfterCommas, []}, |
| 101 | + {Credo.Check.Readability.StringSigils, []}, |
| 102 | + {Credo.Check.Readability.TrailingBlankLine, []}, |
| 103 | + {Credo.Check.Readability.TrailingWhiteSpace, []}, |
| 104 | + {Credo.Check.Readability.UnnecessaryAliasExpansion, []}, |
| 105 | + {Credo.Check.Readability.VariableNames, []}, |
| 106 | + {Credo.Check.Readability.WithSingleClause, []}, |
96 | 107 |
|
97 | | - # |
98 | | - ## Refactoring Opportunities |
99 | | - # |
100 | | - {Credo.Check.Refactor.CondStatements, []}, |
101 | | - {Credo.Check.Refactor.CyclomaticComplexity, []}, |
102 | | - {Credo.Check.Refactor.FunctionArity, []}, |
103 | | - {Credo.Check.Refactor.LongQuoteBlocks, []}, |
104 | | - {Credo.Check.Refactor.MapInto, []}, |
105 | | - {Credo.Check.Refactor.MatchInCondition, []}, |
106 | | - {Credo.Check.Refactor.NegatedConditionsInUnless, []}, |
107 | | - {Credo.Check.Refactor.NegatedConditionsWithElse, []}, |
108 | | - {Credo.Check.Refactor.Nesting, []}, |
109 | | - {Credo.Check.Refactor.PipeChainStart, |
110 | | - [excluded_argument_types: [:atom, :binary, :fn, :keyword], excluded_functions: []]}, |
111 | | - {Credo.Check.Refactor.UnlessWithElse, []}, |
| 108 | + # |
| 109 | + ## Refactoring Opportunities |
| 110 | + # |
| 111 | + {Credo.Check.Refactor.Apply, []}, |
| 112 | + {Credo.Check.Refactor.CondStatements, []}, |
| 113 | + {Credo.Check.Refactor.CyclomaticComplexity, []}, |
| 114 | + {Credo.Check.Refactor.FilterCount, []}, |
| 115 | + {Credo.Check.Refactor.FilterFilter, []}, |
| 116 | + {Credo.Check.Refactor.FunctionArity, []}, |
| 117 | + {Credo.Check.Refactor.LongQuoteBlocks, []}, |
| 118 | + {Credo.Check.Refactor.MapJoin, []}, |
| 119 | + {Credo.Check.Refactor.MatchInCondition, []}, |
| 120 | + {Credo.Check.Refactor.NegatedConditionsInUnless, []}, |
| 121 | + {Credo.Check.Refactor.NegatedConditionsWithElse, []}, |
| 122 | + {Credo.Check.Refactor.Nesting, []}, |
| 123 | + {Credo.Check.Refactor.RedundantWithClauseResult, []}, |
| 124 | + {Credo.Check.Refactor.RejectReject, []}, |
| 125 | + {Credo.Check.Refactor.UnlessWithElse, []}, |
| 126 | + {Credo.Check.Refactor.WithClauses, []}, |
112 | 127 |
|
113 | | - # |
114 | | - ## Warnings |
115 | | - # |
116 | | - {Credo.Check.Warning.BoolOperationOnSameValues, []}, |
117 | | - {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, |
118 | | - {Credo.Check.Warning.IExPry, []}, |
119 | | - {Credo.Check.Warning.IoInspect, []}, |
120 | | - {Credo.Check.Warning.LazyLogging, []}, |
121 | | - {Credo.Check.Warning.OperationOnSameValues, []}, |
122 | | - {Credo.Check.Warning.OperationWithConstantResult, []}, |
123 | | - {Credo.Check.Warning.RaiseInsideRescue, []}, |
124 | | - {Credo.Check.Warning.UnusedEnumOperation, []}, |
125 | | - {Credo.Check.Warning.UnusedFileOperation, []}, |
126 | | - {Credo.Check.Warning.UnusedKeywordOperation, []}, |
127 | | - {Credo.Check.Warning.UnusedListOperation, []}, |
128 | | - {Credo.Check.Warning.UnusedPathOperation, []}, |
129 | | - {Credo.Check.Warning.UnusedRegexOperation, []}, |
130 | | - {Credo.Check.Warning.UnusedStringOperation, []}, |
131 | | - {Credo.Check.Warning.UnusedTupleOperation, []}, |
| 128 | + # |
| 129 | + ## Warnings |
| 130 | + # |
| 131 | + {Credo.Check.Warning.ApplicationConfigInModuleAttribute, []}, |
| 132 | + {Credo.Check.Warning.BoolOperationOnSameValues, []}, |
| 133 | + {Credo.Check.Warning.Dbg, []}, |
| 134 | + {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, |
| 135 | + {Credo.Check.Warning.IExPry, []}, |
| 136 | + {Credo.Check.Warning.IoInspect, []}, |
| 137 | + {Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []}, |
| 138 | + {Credo.Check.Warning.OperationOnSameValues, []}, |
| 139 | + {Credo.Check.Warning.OperationWithConstantResult, []}, |
| 140 | + {Credo.Check.Warning.RaiseInsideRescue, []}, |
| 141 | + {Credo.Check.Warning.SpecWithStruct, []}, |
| 142 | + {Credo.Check.Warning.UnsafeExec, []}, |
| 143 | + {Credo.Check.Warning.UnusedEnumOperation, []}, |
| 144 | + {Credo.Check.Warning.UnusedFileOperation, []}, |
| 145 | + {Credo.Check.Warning.UnusedKeywordOperation, []}, |
| 146 | + {Credo.Check.Warning.UnusedListOperation, []}, |
| 147 | + {Credo.Check.Warning.UnusedPathOperation, []}, |
| 148 | + {Credo.Check.Warning.UnusedRegexOperation, []}, |
| 149 | + {Credo.Check.Warning.UnusedStringOperation, []}, |
| 150 | + {Credo.Check.Warning.UnusedTupleOperation, []}, |
| 151 | + {Credo.Check.Warning.WrongTestFileExtension, []} |
| 152 | + ], |
| 153 | + disabled: [ |
| 154 | + # |
| 155 | + # Checks scheduled for next check update (opt-in for now) |
| 156 | + {Credo.Check.Refactor.UtcNowTruncate, []}, |
132 | 157 |
|
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} |
| 158 | + # |
| 159 | + # Controversial and experimental checks (opt-in, just move the check to `:enabled` |
| 160 | + # and be sure to use `mix credo --strict` to see low priority checks) |
| 161 | + # |
| 162 | + {Credo.Check.Consistency.MultiAliasImportRequireUse, []}, |
| 163 | + {Credo.Check.Consistency.UnusedVariableNames, []}, |
| 164 | + {Credo.Check.Design.DuplicatedCode, []}, |
| 165 | + {Credo.Check.Design.SkipTestWithoutComment, []}, |
| 166 | + {Credo.Check.Readability.AliasAs, []}, |
| 167 | + {Credo.Check.Readability.BlockPipe, []}, |
| 168 | + {Credo.Check.Readability.ImplTrue, []}, |
| 169 | + {Credo.Check.Readability.MultiAlias, []}, |
| 170 | + {Credo.Check.Readability.NestedFunctionCalls, []}, |
| 171 | + {Credo.Check.Readability.OneArityFunctionInPipe, []}, |
| 172 | + {Credo.Check.Readability.OnePipePerLine, []}, |
| 173 | + {Credo.Check.Readability.SeparateAliasRequire, []}, |
| 174 | + {Credo.Check.Readability.SingleFunctionToBlockPipe, []}, |
| 175 | + {Credo.Check.Readability.SinglePipe, []}, |
| 176 | + {Credo.Check.Readability.Specs, []}, |
| 177 | + {Credo.Check.Readability.StrictModuleLayout, []}, |
| 178 | + {Credo.Check.Readability.WithCustomTaggedTuple, []}, |
| 179 | + {Credo.Check.Refactor.ABCSize, []}, |
| 180 | + {Credo.Check.Refactor.AppendSingleItem, []}, |
| 181 | + {Credo.Check.Refactor.DoubleBooleanNegation, []}, |
| 182 | + {Credo.Check.Refactor.FilterReject, []}, |
| 183 | + {Credo.Check.Refactor.IoPuts, []}, |
| 184 | + {Credo.Check.Refactor.MapMap, []}, |
| 185 | + {Credo.Check.Refactor.ModuleDependencies, []}, |
| 186 | + {Credo.Check.Refactor.NegatedIsNil, []}, |
| 187 | + {Credo.Check.Refactor.PassAsyncInTestCases, []}, |
| 188 | + {Credo.Check.Refactor.PipeChainStart, []}, |
| 189 | + {Credo.Check.Refactor.RejectFilter, []}, |
| 190 | + {Credo.Check.Refactor.VariableRebinding, []}, |
| 191 | + {Credo.Check.Warning.LazyLogging, []}, |
| 192 | + {Credo.Check.Warning.LeakyEnvironment, []}, |
| 193 | + {Credo.Check.Warning.MapGetUnsafePass, []}, |
| 194 | + {Credo.Check.Warning.MixEnv, []}, |
| 195 | + {Credo.Check.Warning.UnsafeToAtom, []} |
145 | 196 |
|
146 | | - # Custom checks can be created using `mix credo.gen.check`. |
147 | | - # |
148 | | - ] |
| 197 | + # {Credo.Check.Refactor.MapInto, []}, |
| 198 | + |
| 199 | + # |
| 200 | + # Custom checks can be created using `mix credo.gen.check`. |
| 201 | + # |
| 202 | + ] |
| 203 | + } |
149 | 204 | } |
150 | 205 | ] |
151 | 206 | } |
0 commit comments