|
21 | 21 | # You can give explicit globs or simply directories. |
22 | 22 | # In the latter case `**/*.{ex,exs}` will be used. |
23 | 23 | # |
24 | | - included: ["lib/", "src/", "web/", "apps/"], |
25 | | - excluded: [~r"/_build/", ~r"/deps/"] |
| 24 | + included: ["lib/", "src/", "test/", "web/", "apps/", "bench/", "mix.exs"], |
| 25 | + excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"] |
26 | 26 | }, |
27 | 27 | # |
28 | 28 | # If you create your own checks, you must specify the source files for |
|
33 | 33 | # If you want to enforce a style guide and need a more traditional linting |
34 | 34 | # experience, you can change `strict` to `true` below: |
35 | 35 | # |
36 | | - strict: false, |
| 36 | + strict: true, |
37 | 37 | # |
38 | 38 | # If you want to use uncolored output by default, you can change `color` |
39 | 39 | # to `false` below: |
|
48 | 48 | # {Credo.Check.Design.DuplicatedCode, false} |
49 | 49 | # |
50 | 50 | checks: [ |
| 51 | + # |
| 52 | + ## Consistency Checks |
| 53 | + # |
51 | 54 | {Credo.Check.Consistency.ExceptionNames}, |
52 | 55 | {Credo.Check.Consistency.LineEndings}, |
53 | 56 | {Credo.Check.Consistency.ParameterPatternMatching}, |
54 | 57 | {Credo.Check.Consistency.SpaceAroundOperators}, |
55 | 58 | {Credo.Check.Consistency.SpaceInParentheses}, |
56 | 59 | {Credo.Check.Consistency.TabsOrSpaces}, |
57 | 60 |
|
| 61 | + # |
| 62 | + ## Design Checks |
| 63 | + # |
58 | 64 | # You can customize the priority of any check |
59 | 65 | # Priority values are: `low, normal, high, higher` |
60 | 66 | # |
61 | 67 | {Credo.Check.Design.AliasUsage, priority: :low}, |
62 | | - |
63 | 68 | # For some checks, you can also set other parameters |
64 | 69 | # |
65 | 70 | # If you don't want the `setup` and `test` macro calls in ExUnit tests |
66 | 71 | # or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just |
67 | 72 | # set the `excluded_macros` parameter to `[:schema, :setup, :test]`. |
68 | 73 | # |
69 | 74 | {Credo.Check.Design.DuplicatedCode, excluded_macros: []}, |
70 | | - |
71 | 75 | # You can also customize the exit_status of each check. |
72 | 76 | # If you don't want TODO comments to cause `mix credo` to fail, just |
73 | 77 | # set this value to 0 (zero). |
74 | 78 | # |
75 | 79 | {Credo.Check.Design.TagTODO, exit_status: 2}, |
76 | 80 | {Credo.Check.Design.TagFIXME}, |
77 | 81 |
|
| 82 | + # |
| 83 | + ## Readability Checks |
| 84 | + # |
| 85 | + {Credo.Check.Readability.AliasOrder}, |
78 | 86 | {Credo.Check.Readability.FunctionNames}, |
79 | 87 | {Credo.Check.Readability.LargeNumbers}, |
80 | 88 | {Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80}, |
81 | 89 | {Credo.Check.Readability.ModuleAttributeNames}, |
82 | | - {Credo.Check.Readability.ModuleDoc, false}, |
| 90 | + {Credo.Check.Readability.ModuleDoc}, |
83 | 91 | {Credo.Check.Readability.ModuleNames}, |
84 | 92 | {Credo.Check.Readability.ParenthesesOnZeroArityDefs}, |
85 | 93 | {Credo.Check.Readability.ParenthesesInCondition}, |
|
93 | 101 | {Credo.Check.Readability.Semicolons}, |
94 | 102 | {Credo.Check.Readability.SpaceAfterCommas}, |
95 | 103 |
|
| 104 | + # |
| 105 | + ## Refactoring Opportunities |
| 106 | + # |
96 | 107 | {Credo.Check.Refactor.DoubleBooleanNegation}, |
97 | 108 | {Credo.Check.Refactor.CondStatements}, |
98 | 109 | {Credo.Check.Refactor.CyclomaticComplexity}, |
99 | 110 | {Credo.Check.Refactor.FunctionArity}, |
100 | 111 | {Credo.Check.Refactor.LongQuoteBlocks}, |
| 112 | + {Credo.Check.Refactor.MapInto}, |
101 | 113 | {Credo.Check.Refactor.MatchInCondition}, |
102 | 114 | {Credo.Check.Refactor.NegatedConditionsInUnless}, |
103 | 115 | {Credo.Check.Refactor.NegatedConditionsWithElse}, |
104 | 116 | {Credo.Check.Refactor.Nesting}, |
105 | | - {Credo.Check.Refactor.PipeChainStart}, |
| 117 | + {Credo.Check.Refactor.PipeChainStart, |
| 118 | + excluded_argument_types: [:atom, :binary, :fn, :keyword], excluded_functions: []}, |
106 | 119 | {Credo.Check.Refactor.UnlessWithElse}, |
107 | 120 |
|
| 121 | + # |
| 122 | + ## Warnings |
| 123 | + # |
108 | 124 | {Credo.Check.Warning.BoolOperationOnSameValues}, |
109 | 125 | {Credo.Check.Warning.ExpensiveEmptyEnumCheck}, |
110 | 126 | {Credo.Check.Warning.IExPry}, |
|
120 | 136 | {Credo.Check.Warning.UnusedRegexOperation}, |
121 | 137 | {Credo.Check.Warning.UnusedStringOperation}, |
122 | 138 | {Credo.Check.Warning.UnusedTupleOperation}, |
123 | | - {Credo.Check.Warning.RaiseInsideRescue, false}, |
| 139 | + {Credo.Check.Warning.RaiseInsideRescue}, |
124 | 140 |
|
| 141 | + # |
125 | 142 | # Controversial and experimental checks (opt-in, just remove `, false`) |
126 | 143 | # |
127 | 144 | {Credo.Check.Refactor.ABCSize, false}, |
|
130 | 147 | {Credo.Check.Warning.MapGetUnsafePass, false}, |
131 | 148 | {Credo.Check.Consistency.MultiAliasImportRequireUse, false}, |
132 | 149 |
|
| 150 | + # |
133 | 151 | # Deprecated checks (these will be deleted after a grace period) |
134 | 152 | # |
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}, |
| 153 | + {Credo.Check.Readability.Specs, false} |
140 | 154 |
|
| 155 | + # |
141 | 156 | # Custom checks can be created using `mix credo.gen.check`. |
142 | 157 | # |
143 | 158 | ] |
|
0 commit comments