Skip to content

Commit 7758c6d

Browse files
committed
linter: 💅 setup credo
1 parent c155cdc commit 7758c6d

File tree

1 file changed

+220
-0
lines changed

1 file changed

+220
-0
lines changed

.credo.exs

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

0 commit comments

Comments
 (0)