-
Notifications
You must be signed in to change notification settings - Fork 0
/
.credo.exs
145 lines (136 loc) · 6.09 KB
/
.credo.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
alias Credo.Check
%{
configs: [
%{
name: "default",
files: %{
included: [
"lib/",
"src/",
"web/",
"apps/*/lib/",
"apps/*/src/",
"apps/*/web/"
],
excluded: [~r"/tests/", ~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
},
plugins: [],
requires: [],
strict: true,
parse_timeout: 5000,
color: true,
checks: %{
enabled: [
## Consistency Checks ------------------------------------------------
{Check.Consistency.ExceptionNames, []},
{Check.Consistency.LineEndings, []},
{Check.Consistency.ParameterPatternMatching, []},
{Check.Consistency.SpaceAroundOperators, []},
{Check.Consistency.SpaceInParentheses, []},
{Check.Consistency.TabsOrSpaces, []},
## Design Checks -----------------------------------------------------
{Check.Design.AliasUsage, if_nested_deeper_than: 2},
## Readability Checks ------------------------------------------------
{Check.Readability.AliasOrder, []},
{Check.Readability.FunctionNames, []},
{Check.Readability.LargeNumbers, []},
{Check.Readability.MaxLineLength, priority: :low, max_length: 120},
{Check.Readability.ModuleAttributeNames, []},
{Check.Readability.ModuleDoc, []},
{Check.Readability.ModuleNames, []},
{Check.Readability.ParenthesesInCondition, []},
{Check.Readability.ParenthesesOnZeroArityDefs, []},
{Check.Readability.PipeIntoAnonymousFunctions, []},
{Check.Readability.PredicateFunctionNames, []},
{Check.Readability.PreferImplicitTry, []},
{Check.Readability.RedundantBlankLines, []},
{Check.Readability.Semicolons, []},
{Check.Readability.SpaceAfterCommas, []},
{Check.Readability.StringSigils, []},
{Check.Readability.TrailingBlankLine, []},
{Check.Readability.TrailingWhiteSpace, []},
{Check.Readability.UnnecessaryAliasExpansion, []},
{Check.Readability.VariableNames, []},
{Check.Readability.WithSingleClause, []},
## Refactoring Opportunities -----------------------------------------
{Check.Refactor.Apply, []},
{Check.Refactor.CondStatements, []},
{Check.Refactor.CyclomaticComplexity, [max_complexity: 15]},
{Check.Refactor.FunctionArity, []},
{Check.Refactor.LongQuoteBlocks, []},
{Check.Refactor.MatchInCondition, []},
{Check.Refactor.MapJoin, []},
{Check.Refactor.NegatedConditionsInUnless, []},
{Check.Refactor.NegatedConditionsWithElse, []},
{Check.Refactor.Nesting, [max_nesting: 4]},
{Check.Refactor.UnlessWithElse, []},
{Check.Refactor.WithClauses, []},
{Check.Refactor.FilterFilter, []},
{Check.Refactor.RejectReject, []},
{Check.Refactor.RedundantWithClauseResult, []},
## Warnings ----------------------------------------------------------
{Check.Warning.ApplicationConfigInModuleAttribute, []},
{Check.Warning.BoolOperationOnSameValues, []},
{Check.Warning.ExpensiveEmptyEnumCheck, []},
{Check.Warning.IExPry, []},
{Check.Warning.IoInspect, []},
{Check.Warning.OperationOnSameValues, []},
{Check.Warning.OperationWithConstantResult, []},
{Check.Warning.RaiseInsideRescue, []},
{Check.Warning.SpecWithStruct, []},
{Check.Warning.WrongTestFileExtension, []},
{Check.Warning.UnusedEnumOperation, []},
{Check.Warning.UnusedFileOperation, []},
{Check.Warning.UnusedKeywordOperation, []},
{Check.Warning.UnusedListOperation, []},
{Check.Warning.UnusedPathOperation, []},
{Check.Warning.UnusedRegexOperation, []},
{Check.Warning.UnusedStringOperation, []},
{Check.Warning.UnusedTupleOperation, []},
{Check.Warning.UnsafeExec, []},
## Checks which should always be on for consistency-sake IMO ---------
{Check.Consistency.MultiAliasImportRequireUse, []},
{Check.Consistency.UnusedVariableNames, force: :meaningful},
{Check.Design.DuplicatedCode, []},
{Check.Design.SkipTestWithoutComment, []},
{Check.Readability.ImplTrue, []},
{Check.Readability.MultiAlias, []},
{Check.Readability.NestedFunctionCalls, []},
{Check.Readability.SeparateAliasRequire, []},
{Check.Readability.SingleFunctionToBlockPipe, []},
{Check.Readability.SinglePipe, []},
{Check.Readability.StrictModuleLayout, []},
{Check.Readability.WithCustomTaggedTuple, []},
{Check.Refactor.ABCSize, [max_size: 50]},
{Check.Refactor.DoubleBooleanNegation, []},
{Check.Refactor.FilterReject, []},
{Check.Refactor.MapMap, []},
{Check.Refactor.NegatedIsNil, []},
{Check.Refactor.PipeChainStart, []},
{Check.Refactor.RejectFilter, []},
{Check.Refactor.VariableRebinding, []},
{Check.Warning.LeakyEnvironment, []},
{Check.Warning.MapGetUnsafePass, []},
{Check.Warning.MixEnv, []},
{Check.Warning.UnsafeToAtom, []},
## Causes Issues with Phoenix ----------------------------------------
{Check.Readability.Specs, []},
{Check.Refactor.ModuleDependencies, [max_deps: 19]},
## Optional (move to `disabled` based on app domain) -----------------
{Check.Refactor.IoPuts, []}
],
disabled: [
## Checks which are overly limiting ----------------------------------
{Check.Design.TagTODO, exit_status: 2},
{Check.Design.TagFIXME, []},
{Check.Readability.BlockPipe, []},
{Check.Readability.AliasAs, []},
{Check.Refactor.AppendSingleItem, []},
## Incompatible with modern versions of Elixir -----------------------
{Check.Refactor.MapInto, []},
{Check.Warning.LazyLogging, []}
]
}
}
]
}