Skip to content

Commit 5dcbd48

Browse files
brienwrjanja
authored andcommitted
Update credo configuration (#281)
1 parent 00039dd commit 5dcbd48

File tree

2 files changed

+93
-70
lines changed

2 files changed

+93
-70
lines changed

.credo.exs

+91-68
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,34 @@
1010
configs: [
1111
%{
1212
#
13-
# Run any config using `mix credo -C <name>`. If no config name is given
13+
# Run any exec using `mix credo -C <name>`. If no exec name is given
1414
# "default" is used.
15+
#
1516
name: "default",
1617
#
1718
# These are the files included in the analysis:
1819
files: %{
1920
#
2021
# You can give explicit globs or simply directories.
2122
# In the latter case `**/*.{ex,exs}` will be used.
22-
included: ["config/", "lib/", "test/"],
23-
excluded: [~r"/_build/", ~r"/deps/", "config/deploy/"]
23+
#
24+
included: ["config/", "lib/", "src/", "test/", "web/", "apps/"],
25+
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/", ~r"config/deploy/"]
2426
},
2527
#
2628
# If you create your own checks, you must specify the source files for
2729
# them here, so they can be loaded by Credo before running the analysis.
28-
requires: [],
2930
#
30-
# Credo automatically checks for updates, like e.g. Hex does.
31-
# You can disable this behaviour below:
32-
check_for_updates: true,
31+
requires: [],
3332
#
3433
# If you want to enforce a style guide and need a more traditional linting
3534
# experience, you can change `strict` to `true` below:
35+
#
3636
strict: true,
3737
#
3838
# If you want to use uncolored output by default, you can change `color`
3939
# to `false` below:
40+
#
4041
color: true,
4142
#
4243
# You can customize the parameters of any check by adding a second element
@@ -47,89 +48,111 @@
4748
# {Credo.Check.Design.DuplicatedCode, false}
4849
#
4950
checks: [
50-
{Credo.Check.Consistency.ExceptionNames},
51-
{Credo.Check.Consistency.LineEndings},
52-
{Credo.Check.Consistency.MultiAliasImportRequireUse},
53-
{Credo.Check.Consistency.ParameterPatternMatching},
54-
{Credo.Check.Consistency.SpaceAroundOperators},
55-
{Credo.Check.Consistency.SpaceInParentheses},
56-
{Credo.Check.Consistency.TabsOrSpaces},
51+
#
52+
## Consistency Checks
53+
#
54+
{Credo.Check.Consistency.ExceptionNames, []},
55+
{Credo.Check.Consistency.LineEndings, []},
56+
{Credo.Check.Consistency.ParameterPatternMatching, []},
57+
{Credo.Check.Consistency.SpaceAroundOperators, []},
58+
{Credo.Check.Consistency.SpaceInParentheses, []},
59+
{Credo.Check.Consistency.TabsOrSpaces, []},
5760

58-
# For some checks, like AliasUsage, you can only customize the priority
61+
#
62+
## Design Checks
63+
#
64+
# You can customize the priority of any check
5965
# Priority values are: `low, normal, high, higher`
60-
{Credo.Check.Design.AliasUsage, priority: :low},
61-
62-
# For others you can set parameters
63-
66+
#
67+
{Credo.Check.Design.AliasUsage, [priority: :low]},
68+
# For some checks, you can also set other parameters
69+
#
6470
# If you don't want the `setup` and `test` macro calls in ExUnit tests
6571
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
6672
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
67-
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
68-
73+
#
74+
{Credo.Check.Design.DuplicatedCode, [excluded_macros: []]},
6975
# You can also customize the exit_status of each check.
7076
# If you don't want TODO comments to cause `mix credo` to fail, just
7177
# set this value to 0 (zero).
72-
{Credo.Check.Design.TagTODO, exit_status: 2},
73-
{Credo.Check.Design.TagFIXME},
78+
#
79+
{Credo.Check.Design.TagTODO, [exit_status: 2]},
80+
{Credo.Check.Design.TagFIXME, []},
7481

75-
{Credo.Check.Readability.FunctionNames},
76-
{Credo.Check.Readability.LargeNumbers},
77-
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 100},
78-
{Credo.Check.Readability.ModuleAttributeNames},
79-
{Credo.Check.Readability.ModuleDoc},
80-
{Credo.Check.Readability.ModuleNames},
81-
{Credo.Check.Readability.ParenthesesOnZeroArityDefs},
82-
{Credo.Check.Readability.ParenthesesInCondition},
83-
{Credo.Check.Readability.PredicateFunctionNames},
84-
{Credo.Check.Readability.PreferImplicitTry},
85-
{Credo.Check.Readability.RedundantBlankLines},
82+
#
83+
## Readability Checks
84+
#
85+
{Credo.Check.Readability.AliasOrder, []},
86+
{Credo.Check.Readability.FunctionNames, []},
87+
{Credo.Check.Readability.LargeNumbers, []},
88+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
89+
{Credo.Check.Readability.ModuleAttributeNames, []},
90+
{Credo.Check.Readability.ModuleDoc, []},
91+
{Credo.Check.Readability.ModuleNames, []},
92+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
93+
{Credo.Check.Readability.ParenthesesInCondition, []},
94+
{Credo.Check.Readability.PredicateFunctionNames, []},
95+
{Credo.Check.Readability.PreferImplicitTry, []},
96+
{Credo.Check.Readability.RedundantBlankLines, []},
8697
{Credo.Check.Readability.StringSigils, false},
87-
{Credo.Check.Readability.TrailingBlankLine},
88-
{Credo.Check.Readability.TrailingWhiteSpace},
89-
{Credo.Check.Readability.VariableNames},
90-
{Credo.Check.Readability.Semicolons},
91-
{Credo.Check.Readability.SpaceAfterCommas},
98+
{Credo.Check.Readability.TrailingBlankLine, []},
99+
{Credo.Check.Readability.TrailingWhiteSpace, []},
100+
{Credo.Check.Readability.VariableNames, []},
101+
{Credo.Check.Readability.Semicolons, []},
102+
{Credo.Check.Readability.SpaceAfterCommas, []},
92103

93-
{Credo.Check.Refactor.DoubleBooleanNegation},
94-
{Credo.Check.Refactor.CondStatements},
95-
{Credo.Check.Refactor.CyclomaticComplexity},
96-
{Credo.Check.Refactor.FunctionArity},
97-
{Credo.Check.Refactor.MatchInCondition},
98-
{Credo.Check.Refactor.NegatedConditionsInUnless},
99-
{Credo.Check.Refactor.NegatedConditionsWithElse},
100-
{Credo.Check.Refactor.Nesting},
101-
{Credo.Check.Refactor.PipeChainStart},
102-
{Credo.Check.Refactor.UnlessWithElse},
104+
#
105+
## Refactoring Opportunities
106+
#
107+
{Credo.Check.Refactor.DoubleBooleanNegation, []},
108+
{Credo.Check.Refactor.CondStatements, []},
109+
{Credo.Check.Refactor.CyclomaticComplexity, []},
110+
{Credo.Check.Refactor.FunctionArity, []},
111+
{Credo.Check.Refactor.LongQuoteBlocks, []},
112+
{Credo.Check.Refactor.MapInto, []},
113+
{Credo.Check.Refactor.MatchInCondition, []},
114+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
115+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
116+
{Credo.Check.Refactor.Nesting, []},
117+
{Credo.Check.Refactor.PipeChainStart,
118+
[excluded_argument_types: [:atom, :binary, :fn, :keyword], excluded_functions: []]},
119+
{Credo.Check.Refactor.UnlessWithElse, []},
103120

104-
{Credo.Check.Warning.BoolOperationOnSameValues},
105-
{Credo.Check.Warning.IExPry},
106-
{Credo.Check.Warning.IoInspect},
107-
{Credo.Check.Warning.LazyLogging},
108-
{Credo.Check.Warning.OperationOnSameValues},
109-
{Credo.Check.Warning.OperationWithConstantResult},
110-
{Credo.Check.Warning.UnusedEnumOperation},
111-
{Credo.Check.Warning.UnusedFileOperation},
112-
{Credo.Check.Warning.UnusedKeywordOperation},
113-
{Credo.Check.Warning.UnusedListOperation},
114-
{Credo.Check.Warning.UnusedPathOperation},
115-
{Credo.Check.Warning.UnusedRegexOperation},
116-
{Credo.Check.Warning.UnusedStringOperation},
117-
{Credo.Check.Warning.UnusedTupleOperation},
121+
#
122+
## Warnings
123+
#
124+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
125+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
126+
{Credo.Check.Warning.IExPry, []},
127+
{Credo.Check.Warning.IoInspect, []},
128+
{Credo.Check.Warning.LazyLogging, []},
129+
{Credo.Check.Warning.OperationOnSameValues, []},
130+
{Credo.Check.Warning.OperationWithConstantResult, []},
131+
{Credo.Check.Warning.UnusedEnumOperation, []},
132+
{Credo.Check.Warning.UnusedFileOperation, []},
133+
{Credo.Check.Warning.UnusedKeywordOperation, []},
134+
{Credo.Check.Warning.UnusedListOperation, []},
135+
{Credo.Check.Warning.UnusedPathOperation, []},
136+
{Credo.Check.Warning.UnusedRegexOperation, []},
137+
{Credo.Check.Warning.UnusedStringOperation, []},
138+
{Credo.Check.Warning.UnusedTupleOperation, []},
139+
{Credo.Check.Warning.RaiseInsideRescue, []},
118140

141+
#
119142
# Controversial and experimental checks (opt-in, just remove `, false`)
120143
#
121144
{Credo.Check.Refactor.ABCSize, false},
122145
{Credo.Check.Refactor.AppendSingleItem, false},
123146
{Credo.Check.Refactor.VariableRebinding, false},
124147
{Credo.Check.Warning.MapGetUnsafePass, false},
148+
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
125149

150+
#
126151
# Deprecated checks (these will be deleted after a grace period)
127-
{Credo.Check.Readability.Specs, false},
128-
{Credo.Check.Warning.NameRedeclarationByAssignment, false},
129-
{Credo.Check.Warning.NameRedeclarationByCase, false},
130-
{Credo.Check.Warning.NameRedeclarationByDef, false},
131-
{Credo.Check.Warning.NameRedeclarationByFn, false},
152+
#
153+
{Credo.Check.Readability.Specs, false}
132154

155+
#
133156
# Custom checks can be created using `mix credo.gen.check`.
134157
#
135158
]

mix.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
%{
22
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
33
"certifi": {:hex, :certifi, "2.4.2", "75424ff0f3baaccfd34b1214184b6ef616d89e420b258bb0a5ea7d7bc628f7f0", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"},
4-
"credo": {:hex, :credo, "0.10.1", "e85efaf2dd7054399083ab2c6a5199f6cb1805de1a5b00d9e8c5f07033407b1f", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
4+
"credo": {:hex, :credo, "0.10.2", "03ad3a1eff79a16664ed42fc2975b5e5d0ce243d69318060c626c34720a49512", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
55
"dialyxir": {:hex, :dialyxir, "1.0.0-rc.3", "774306f84973fc3f1e2e8743eeaa5f5d29b117f3916e5de74c075c02f1b8ef55", [:mix], [], "hexpm"},
66
"earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "hexpm"},
77
"ex_doc": {:hex, :ex_doc, "0.18.4", "4406b8891cecf1352f49975c6d554e62e4341ceb41b9338949077b0d4a97b949", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
88
"excoveralls": {:hex, :excoveralls, "0.10.0", "a4508bdd408829f38e7b2519f234b7fd5c83846099cda348efcb5291b081200c", [:mix], [{:hackney, "~> 1.13", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
99
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"},
1010
"hackney": {:hex, :hackney, "1.14.0", "66e29e78feba52176c3a4213d42b29bdc4baff93a18cfe480f73b04677139dee", [:rebar3], [{:certifi, "2.4.2", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.4", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
1111
"idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
12-
"jason": {:hex, :jason, "1.1.1", "d3ccb840dfb06f2f90a6d335b536dd074db748b3e7f5b11ab61d239506585eb2", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
12+
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
1313
"jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"},
1414
"junit_formatter": {:hex, :junit_formatter, "2.2.0", "da6093f0740c58a824f9585ebb7cb1b960efaecf48d1fa969e95d9c47c6b19dd", [:mix], [], "hexpm"},
1515
"makeup": {:hex, :makeup, "0.5.5", "9e08dfc45280c5684d771ad58159f718a7b5788596099bdfb0284597d368a882", [:mix], [{:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},

0 commit comments

Comments
 (0)