Skip to content

Commit 14c0f3b

Browse files
committed
Tau - add credo support for development
1 parent 104b195 commit 14c0f3b

File tree

3 files changed

+214
-1
lines changed

3 files changed

+214
-1
lines changed

app/server/beam/tau/.credo.exs

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
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+
{Credo.Check.Design.AliasUsage,
86+
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
87+
# You can also customize the exit_status of each check.
88+
# If you don't want TODO comments to cause `mix credo` to fail, just
89+
# set this value to 0 (zero).
90+
#
91+
{Credo.Check.Design.TagTODO, [exit_status: 2]},
92+
{Credo.Check.Design.TagFIXME, []},
93+
94+
#
95+
## Readability Checks
96+
#
97+
{Credo.Check.Readability.AliasOrder, []},
98+
{Credo.Check.Readability.FunctionNames, []},
99+
{Credo.Check.Readability.LargeNumbers, []},
100+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
101+
{Credo.Check.Readability.ModuleAttributeNames, []},
102+
{Credo.Check.Readability.ModuleDoc, []},
103+
{Credo.Check.Readability.ModuleNames, []},
104+
{Credo.Check.Readability.ParenthesesInCondition, []},
105+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
106+
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
107+
{Credo.Check.Readability.PredicateFunctionNames, []},
108+
{Credo.Check.Readability.PreferImplicitTry, []},
109+
{Credo.Check.Readability.RedundantBlankLines, []},
110+
{Credo.Check.Readability.Semicolons, []},
111+
{Credo.Check.Readability.SpaceAfterCommas, []},
112+
{Credo.Check.Readability.StringSigils, []},
113+
{Credo.Check.Readability.TrailingBlankLine, []},
114+
{Credo.Check.Readability.TrailingWhiteSpace, []},
115+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
116+
{Credo.Check.Readability.VariableNames, []},
117+
{Credo.Check.Readability.WithSingleClause, []},
118+
119+
#
120+
## Refactoring Opportunities
121+
#
122+
{Credo.Check.Refactor.Apply, []},
123+
{Credo.Check.Refactor.CondStatements, []},
124+
{Credo.Check.Refactor.CyclomaticComplexity, []},
125+
{Credo.Check.Refactor.FunctionArity, []},
126+
{Credo.Check.Refactor.LongQuoteBlocks, []},
127+
{Credo.Check.Refactor.MatchInCondition, []},
128+
{Credo.Check.Refactor.MapJoin, []},
129+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
130+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
131+
{Credo.Check.Refactor.Nesting, []},
132+
{Credo.Check.Refactor.UnlessWithElse, []},
133+
{Credo.Check.Refactor.WithClauses, []},
134+
{Credo.Check.Refactor.FilterFilter, []},
135+
{Credo.Check.Refactor.RejectReject, []},
136+
{Credo.Check.Refactor.RedundantWithClauseResult, []},
137+
138+
#
139+
## Warnings
140+
#
141+
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
142+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
143+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
144+
{Credo.Check.Warning.IExPry, []},
145+
{Credo.Check.Warning.IoInspect, []},
146+
{Credo.Check.Warning.OperationOnSameValues, []},
147+
{Credo.Check.Warning.OperationWithConstantResult, []},
148+
{Credo.Check.Warning.RaiseInsideRescue, []},
149+
{Credo.Check.Warning.SpecWithStruct, []},
150+
{Credo.Check.Warning.WrongTestFileExtension, []},
151+
{Credo.Check.Warning.UnusedEnumOperation, []},
152+
{Credo.Check.Warning.UnusedFileOperation, []},
153+
{Credo.Check.Warning.UnusedKeywordOperation, []},
154+
{Credo.Check.Warning.UnusedListOperation, []},
155+
{Credo.Check.Warning.UnusedPathOperation, []},
156+
{Credo.Check.Warning.UnusedRegexOperation, []},
157+
{Credo.Check.Warning.UnusedStringOperation, []},
158+
{Credo.Check.Warning.UnusedTupleOperation, []},
159+
{Credo.Check.Warning.UnsafeExec, []}
160+
],
161+
disabled: [
162+
#
163+
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)
164+
165+
#
166+
# Controversial and experimental checks (opt-in, just move the check to `:enabled`
167+
# and be sure to use `mix credo --strict` to see low priority checks)
168+
#
169+
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
170+
{Credo.Check.Consistency.UnusedVariableNames, []},
171+
{Credo.Check.Design.DuplicatedCode, []},
172+
{Credo.Check.Design.SkipTestWithoutComment, []},
173+
{Credo.Check.Readability.AliasAs, []},
174+
{Credo.Check.Readability.BlockPipe, []},
175+
{Credo.Check.Readability.ImplTrue, []},
176+
{Credo.Check.Readability.MultiAlias, []},
177+
{Credo.Check.Readability.NestedFunctionCalls, []},
178+
{Credo.Check.Readability.SeparateAliasRequire, []},
179+
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
180+
{Credo.Check.Readability.SinglePipe, []},
181+
{Credo.Check.Readability.Specs, []},
182+
{Credo.Check.Readability.StrictModuleLayout, []},
183+
{Credo.Check.Readability.WithCustomTaggedTuple, []},
184+
{Credo.Check.Refactor.ABCSize, []},
185+
{Credo.Check.Refactor.AppendSingleItem, []},
186+
{Credo.Check.Refactor.DoubleBooleanNegation, []},
187+
{Credo.Check.Refactor.FilterReject, []},
188+
{Credo.Check.Refactor.IoPuts, []},
189+
{Credo.Check.Refactor.MapMap, []},
190+
{Credo.Check.Refactor.ModuleDependencies, []},
191+
{Credo.Check.Refactor.NegatedIsNil, []},
192+
{Credo.Check.Refactor.PipeChainStart, []},
193+
{Credo.Check.Refactor.RejectFilter, []},
194+
{Credo.Check.Refactor.VariableRebinding, []},
195+
{Credo.Check.Warning.LazyLogging, []},
196+
{Credo.Check.Warning.LeakyEnvironment, []},
197+
{Credo.Check.Warning.MapGetUnsafePass, []},
198+
{Credo.Check.Warning.MixEnv, []},
199+
{Credo.Check.Warning.UnsafeToAtom, []}
200+
201+
# {Credo.Check.Refactor.MapInto, []},
202+
203+
#
204+
# Custom checks can be created using `mix credo.gen.check`.
205+
#
206+
]
207+
}
208+
}
209+
]
210+
}

app/server/beam/tau/mix.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ defmodule Tau.MixProject do
5252
{:petal_components, "~> 0.19"},
5353
{:exsync, "~> 0.2", runtime: Mix.env() == :dev, only: :dev},
5454
{:rustler, "~> 0.26"},
55-
{:logger_file_backend, "~> 0.0.13"}
55+
{:logger_file_backend, "~> 0.0.13"},
56+
{:credo, "~> 1.6", only: [:dev, :test], runtime: false}
5657
]
5758
end
5859

app/server/beam/tau/mix.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
%{
2+
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
23
"castore": {:hex, :castore, "0.1.20", "62a0126cbb7cb3e259257827b9190f88316eb7aa3fdac01fd6f2dfd64e7f46e9", [:mix], [], "hexpm", "a020b7650529c986c454a4035b6b13a328e288466986307bea3aadb4c95ac98a"},
34
"cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"},
45
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
56
"cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
7+
"credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"},
68
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
79
"ecto": {:hex, :ecto, "3.9.2", "017db3bc786ff64271108522c01a5d3f6ba0aea5c84912cfb0dd73bf13684108", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "21466d5177e09e55289ac7eade579a642578242c7a3a9f91ad5c6583337a9d15"},
810
"esbuild": {:hex, :esbuild, "0.6.0", "9ba6ead054abd43cb3d7b14946a0cdd1493698ccd8e054e0e5d6286d7f0f509c", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "30f9a05d4a5bab0d3e37398f312f80864e1ee1a081ca09149d06d474318fd040"},

0 commit comments

Comments
 (0)