|
| 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 | + # |
| 16 | + name: "default", |
| 17 | + # |
| 18 | + # These are the files included in the analysis: |
| 19 | + files: %{ |
| 20 | + # |
| 21 | + # You can give explicit globs or simply directories. |
| 22 | + # In the latter case `**/*.{ex,exs}` will be used. |
| 23 | + # |
| 24 | + included: [ |
| 25 | + "lib/", |
| 26 | + "src/", |
| 27 | + "test/", |
| 28 | + "web/", |
| 29 | + "apps/*/lib/", |
| 30 | + "apps/*/src/", |
| 31 | + "apps/*/test/", |
| 32 | + "apps/*/web/" |
| 33 | + ], |
| 34 | + excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"] |
| 35 | + }, |
| 36 | + # |
| 37 | + # Load and configure plugins here: |
| 38 | + # |
| 39 | + plugins: [], |
| 40 | + # |
| 41 | + # If you create your own checks, you must specify the source files for |
| 42 | + # them here, so they can be loaded by Credo before running the analysis. |
| 43 | + # |
| 44 | + requires: [], |
| 45 | + # |
| 46 | + # If you want to enforce a style guide and need a more traditional linting |
| 47 | + # experience, you can change `strict` to `true` below: |
| 48 | + # |
| 49 | + strict: false, |
| 50 | + # |
| 51 | + # To modify the timeout for parsing files, change this value: |
| 52 | + # |
| 53 | + parse_timeout: 5000, |
| 54 | + # |
| 55 | + # If you want to use uncolored output by default, you can change `color` |
| 56 | + # to `false` below: |
| 57 | + # |
| 58 | + color: true, |
| 59 | + # |
| 60 | + # You can customize the parameters of any check by adding a second element |
| 61 | + # to the tuple. |
| 62 | + # |
| 63 | + # To disable a check put `false` as second element: |
| 64 | + # |
| 65 | + # {Credo.Check.Design.DuplicatedCode, false} |
| 66 | + # |
| 67 | + checks: %{ |
| 68 | + enabled: [ |
| 69 | + # |
| 70 | + ## Consistency Checks |
| 71 | + # |
| 72 | + {Credo.Check.Consistency.ExceptionNames, []}, |
| 73 | + {Credo.Check.Consistency.LineEndings, []}, |
| 74 | + {Credo.Check.Consistency.ParameterPatternMatching, []}, |
| 75 | + {Credo.Check.Consistency.SpaceAroundOperators, []}, |
| 76 | + {Credo.Check.Consistency.SpaceInParentheses, []}, |
| 77 | + {Credo.Check.Consistency.TabsOrSpaces, []}, |
| 78 | + |
| 79 | + # |
| 80 | + ## Design Checks |
| 81 | + # |
| 82 | + # You can customize the priority of any check |
| 83 | + # Priority values are: `low, normal, high, higher` |
| 84 | + # |
| 85 | + # Enabled: aliasing nested modules to collapse the namespace |
| 86 | + # by the primary level (`Tempo.Foo.Bar` → `Bar`) is the house |
| 87 | + # style — it keeps call sites reading as domain verbs rather |
| 88 | + # than fully-qualified paths. `excluded_lastnames` keeps names |
| 89 | + # that would shadow an Elixir/Erlang built-in — or the `:lua` |
| 90 | + # dependency's own `Lua` module — fully qualified (e.g. |
| 91 | + # `Localize.Calendar`, `Localize.Lua`): aliasing those to the |
| 92 | + # bare name silently captures the stdlib/dependency module. |
| 93 | + {Credo.Check.Design.AliasUsage, |
| 94 | + [ |
| 95 | + excluded_lastnames: ~w( |
| 96 | + Calendar Inspect Date Time DateTime NaiveDateTime Range Stream |
| 97 | + Map List Set Keyword Tuple Atom Integer Float String Process |
| 98 | + Task Agent Node Port System IO File Path URI Version Regex |
| 99 | + Module Macro Code Enum Access Base Exception Kernel Lua |
| 100 | + ) |
| 101 | + ]}, |
| 102 | + # Disabled: TODO/FIXME work is tracked in TODO.md, the system |
| 103 | + # of record — inline tags are intentional pointers, not debt |
| 104 | + # for Credo to flag. |
| 105 | + {Credo.Check.Design.TagFIXME, false}, |
| 106 | + {Credo.Check.Design.TagTODO, false}, |
| 107 | + |
| 108 | + # |
| 109 | + ## Readability Checks |
| 110 | + # |
| 111 | + {Credo.Check.Readability.AliasOrder, []}, |
| 112 | + {Credo.Check.Readability.FunctionNames, []}, |
| 113 | + {Credo.Check.Readability.LargeNumbers, []}, |
| 114 | + {Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]}, |
| 115 | + {Credo.Check.Readability.ModuleAttributeNames, []}, |
| 116 | + {Credo.Check.Readability.ModuleDoc, []}, |
| 117 | + {Credo.Check.Readability.ModuleNames, []}, |
| 118 | + {Credo.Check.Readability.ParenthesesInCondition, []}, |
| 119 | + {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, |
| 120 | + {Credo.Check.Readability.PipeIntoAnonymousFunctions, []}, |
| 121 | + {Credo.Check.Readability.PredicateFunctionNames, []}, |
| 122 | + {Credo.Check.Readability.PreferImplicitTry, []}, |
| 123 | + {Credo.Check.Readability.RedundantBlankLines, []}, |
| 124 | + {Credo.Check.Readability.Semicolons, []}, |
| 125 | + {Credo.Check.Readability.SpaceAfterCommas, []}, |
| 126 | + {Credo.Check.Readability.StringSigils, []}, |
| 127 | + {Credo.Check.Readability.TrailingBlankLine, []}, |
| 128 | + {Credo.Check.Readability.TrailingWhiteSpace, []}, |
| 129 | + {Credo.Check.Readability.UnnecessaryAliasExpansion, []}, |
| 130 | + {Credo.Check.Readability.VariableNames, []}, |
| 131 | + {Credo.Check.Readability.WithSingleClause, []}, |
| 132 | + |
| 133 | + # |
| 134 | + ## Refactoring Opportunities |
| 135 | + # |
| 136 | + {Credo.Check.Refactor.Apply, []}, |
| 137 | + {Credo.Check.Refactor.CondStatements, []}, |
| 138 | + # Default (9). Vocabulary dispatch (Allen relations, cron |
| 139 | + # cascade, iteration shapes) is expressed as multi-head |
| 140 | + # function clauses rather than one branchy function. |
| 141 | + {Credo.Check.Refactor.CyclomaticComplexity, []}, |
| 142 | + {Credo.Check.Refactor.FilterCount, []}, |
| 143 | + {Credo.Check.Refactor.FilterFilter, []}, |
| 144 | + {Credo.Check.Refactor.FunctionArity, []}, |
| 145 | + {Credo.Check.Refactor.LongQuoteBlocks, []}, |
| 146 | + {Credo.Check.Refactor.MapJoin, []}, |
| 147 | + {Credo.Check.Refactor.MatchInCondition, []}, |
| 148 | + {Credo.Check.Refactor.NegatedConditionsInUnless, []}, |
| 149 | + {Credo.Check.Refactor.NegatedConditionsWithElse, []}, |
| 150 | + # Default depth (2). A `case`/`with` nested inside another |
| 151 | + # `with`/`if` is extracted to a multi-head helper rather than |
| 152 | + # tolerated — depth 3+ flags. |
| 153 | + {Credo.Check.Refactor.Nesting, []}, |
| 154 | + {Credo.Check.Refactor.RedundantWithClauseResult, []}, |
| 155 | + {Credo.Check.Refactor.RejectReject, []}, |
| 156 | + {Credo.Check.Refactor.UnlessWithElse, []}, |
| 157 | + {Credo.Check.Refactor.WithClauses, []}, |
| 158 | + |
| 159 | + # |
| 160 | + ## Warnings |
| 161 | + # |
| 162 | + {Credo.Check.Warning.ApplicationConfigInModuleAttribute, []}, |
| 163 | + {Credo.Check.Warning.BoolOperationOnSameValues, []}, |
| 164 | + {Credo.Check.Warning.Dbg, []}, |
| 165 | + {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, |
| 166 | + {Credo.Check.Warning.IExPry, []}, |
| 167 | + {Credo.Check.Warning.IoInspect, []}, |
| 168 | + {Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []}, |
| 169 | + {Credo.Check.Warning.OperationOnSameValues, []}, |
| 170 | + {Credo.Check.Warning.OperationWithConstantResult, []}, |
| 171 | + {Credo.Check.Warning.RaiseInsideRescue, []}, |
| 172 | + {Credo.Check.Warning.SpecWithStruct, []}, |
| 173 | + {Credo.Check.Warning.StructFieldAmount, []}, |
| 174 | + {Credo.Check.Warning.UnsafeExec, []}, |
| 175 | + {Credo.Check.Warning.UnusedEnumOperation, []}, |
| 176 | + {Credo.Check.Warning.UnusedFileOperation, []}, |
| 177 | + {Credo.Check.Warning.UnusedKeywordOperation, []}, |
| 178 | + {Credo.Check.Warning.UnusedListOperation, []}, |
| 179 | + {Credo.Check.Warning.UnusedMapOperation, []}, |
| 180 | + {Credo.Check.Warning.UnusedPathOperation, []}, |
| 181 | + {Credo.Check.Warning.UnusedRegexOperation, []}, |
| 182 | + {Credo.Check.Warning.UnusedStringOperation, []}, |
| 183 | + {Credo.Check.Warning.UnusedTupleOperation, []}, |
| 184 | + {Credo.Check.Warning.WrongTestFilename, []} |
| 185 | + ], |
| 186 | + disabled: [ |
| 187 | + # |
| 188 | + # Checks scheduled for next check update (opt-in for now) |
| 189 | + {Credo.Check.Refactor.UtcNowTruncate, []}, |
| 190 | + |
| 191 | + # |
| 192 | + # Controversial and experimental checks (opt-in, just move the check to `:enabled` |
| 193 | + # and be sure to use `mix credo --strict` to see low priority checks) |
| 194 | + # |
| 195 | + {Credo.Check.Consistency.MultiAliasImportRequireUse, []}, |
| 196 | + {Credo.Check.Consistency.UnusedVariableNames, []}, |
| 197 | + {Credo.Check.Design.DuplicatedCode, []}, |
| 198 | + {Credo.Check.Design.SkipTestWithoutComment, []}, |
| 199 | + {Credo.Check.Readability.AliasAs, []}, |
| 200 | + {Credo.Check.Readability.BlockPipe, []}, |
| 201 | + {Credo.Check.Readability.ImplTrue, []}, |
| 202 | + {Credo.Check.Readability.MultiAlias, []}, |
| 203 | + {Credo.Check.Readability.NestedFunctionCalls, []}, |
| 204 | + {Credo.Check.Readability.OneArityFunctionInPipe, []}, |
| 205 | + {Credo.Check.Readability.OnePipePerLine, []}, |
| 206 | + {Credo.Check.Readability.SeparateAliasRequire, []}, |
| 207 | + {Credo.Check.Readability.SingleFunctionToBlockPipe, []}, |
| 208 | + {Credo.Check.Readability.SinglePipe, []}, |
| 209 | + {Credo.Check.Readability.Specs, []}, |
| 210 | + {Credo.Check.Readability.StrictModuleLayout, []}, |
| 211 | + {Credo.Check.Readability.WithCustomTaggedTuple, []}, |
| 212 | + {Credo.Check.Refactor.ABCSize, []}, |
| 213 | + {Credo.Check.Refactor.AppendSingleItem, []}, |
| 214 | + {Credo.Check.Refactor.CondInsteadOfIfElse, []}, |
| 215 | + {Credo.Check.Refactor.DoubleBooleanNegation, []}, |
| 216 | + {Credo.Check.Refactor.FilterReject, []}, |
| 217 | + {Credo.Check.Refactor.IoPuts, []}, |
| 218 | + {Credo.Check.Refactor.MapMap, []}, |
| 219 | + {Credo.Check.Refactor.ModuleDependencies, []}, |
| 220 | + {Credo.Check.Refactor.NegatedIsNil, []}, |
| 221 | + {Credo.Check.Refactor.PassAsyncInTestCases, []}, |
| 222 | + {Credo.Check.Refactor.PipeChainStart, []}, |
| 223 | + {Credo.Check.Refactor.RejectFilter, []}, |
| 224 | + {Credo.Check.Refactor.VariableRebinding, []}, |
| 225 | + {Credo.Check.Warning.LazyLogging, []}, |
| 226 | + {Credo.Check.Warning.LeakyEnvironment, []}, |
| 227 | + {Credo.Check.Warning.MapGetUnsafePass, []}, |
| 228 | + {Credo.Check.Warning.MixEnv, []}, |
| 229 | + {Credo.Check.Warning.UnsafeToAtom, []} |
| 230 | + # {Credo.Check.Warning.UnusedOperation, [{MyMagicModule, [:fun1, :fun2]}]} |
| 231 | + |
| 232 | + # {Credo.Check.Refactor.MapInto, []}, |
| 233 | + |
| 234 | + # |
| 235 | + # Custom checks can be created using `mix credo.gen.check`. |
| 236 | + # |
| 237 | + ] |
| 238 | + } |
| 239 | + } |
| 240 | + ] |
| 241 | +} |
0 commit comments