Skip to content

Commit f6efca5

Browse files
Add credo and ex_doc
1 parent c2b99a7 commit f6efca5

File tree

4 files changed

+136
-1
lines changed

4 files changed

+136
-1
lines changed

.credo.exs

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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+
name: "default",
16+
#
17+
# These are the files included in the analysis:
18+
files: %{
19+
#
20+
# You can give explicit globs or simply directories.
21+
# In the latter case `**/*.{ex,exs}` will be used.
22+
included: ["lib/", "src/", "web/", "apps/"],
23+
excluded: [~r"/_build/", ~r"/deps/"]
24+
},
25+
#
26+
# If you create your own checks, you must specify the source files for
27+
# them here, so they can be loaded by Credo before running the analysis.
28+
requires: [],
29+
#
30+
# Credo automatically checks for updates, like e.g. Hex does.
31+
# You can disable this behaviour below:
32+
check_for_updates: true,
33+
#
34+
# If you want to enforce a style guide and need a more traditional linting
35+
# experience, you can change `strict` to `true` below:
36+
strict: false,
37+
#
38+
# If you want to use uncolored output by default, you can change `color`
39+
# to `false` below:
40+
color: true,
41+
#
42+
# You can customize the parameters of any check by adding a second element
43+
# to the tuple.
44+
#
45+
# To disable a check put `false` as second element:
46+
#
47+
# {Credo.Check.Design.DuplicatedCode, false}
48+
#
49+
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},
57+
58+
# For some checks, like AliasUsage, you can only customize the priority
59+
# Priority values are: `low, normal, high, higher`
60+
{Credo.Check.Design.AliasUsage, priority: :low},
61+
62+
# For others you can set parameters
63+
64+
# If you don't want the `setup` and `test` macro calls in ExUnit tests
65+
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
66+
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
67+
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
68+
69+
# You can also customize the exit_status of each check.
70+
# If you don't want TODO comments to cause `mix credo` to fail, just
71+
# set this value to 0 (zero).
72+
{Credo.Check.Design.TagTODO, exit_status: 2},
73+
{Credo.Check.Design.TagFIXME},
74+
75+
{Credo.Check.Readability.FunctionNames},
76+
{Credo.Check.Readability.LargeNumbers},
77+
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80},
78+
{Credo.Check.Readability.ModuleAttributeNames},
79+
{Credo.Check.Readability.ModuleDoc},
80+
{Credo.Check.Readability.ModuleNames},
81+
{Credo.Check.Readability.NoParenthesesWhenZeroArity},
82+
{Credo.Check.Readability.ParenthesesInCondition},
83+
{Credo.Check.Readability.PredicateFunctionNames},
84+
{Credo.Check.Readability.PreferImplicitTry},
85+
{Credo.Check.Readability.RedundantBlankLines},
86+
{Credo.Check.Readability.Specs},
87+
{Credo.Check.Readability.StringSigils},
88+
{Credo.Check.Readability.TrailingBlankLine},
89+
{Credo.Check.Readability.TrailingWhiteSpace},
90+
{Credo.Check.Readability.VariableNames},
91+
{Credo.Check.Refactor.DoubleBooleanNegation},
92+
93+
# {Credo.Check.Refactor.CaseTrivialMatches}, # deprecated in 0.4.0
94+
{Credo.Check.Refactor.ABCSize},
95+
{Credo.Check.Refactor.CondStatements},
96+
{Credo.Check.Refactor.CyclomaticComplexity},
97+
{Credo.Check.Refactor.FunctionArity},
98+
{Credo.Check.Refactor.MatchInCondition},
99+
{Credo.Check.Refactor.NegatedConditionsInUnless},
100+
{Credo.Check.Refactor.NegatedConditionsWithElse},
101+
{Credo.Check.Refactor.Nesting},
102+
{Credo.Check.Refactor.PipeChainStart},
103+
{Credo.Check.Refactor.UnlessWithElse},
104+
{Credo.Check.Refactor.VariableRebinding},
105+
106+
{Credo.Check.Warning.BoolOperationOnSameValues},
107+
{Credo.Check.Warning.IExPry},
108+
{Credo.Check.Warning.IoInspect},
109+
{Credo.Check.Warning.NameRedeclarationByAssignment},
110+
{Credo.Check.Warning.NameRedeclarationByCase},
111+
{Credo.Check.Warning.NameRedeclarationByDef},
112+
{Credo.Check.Warning.NameRedeclarationByFn},
113+
{Credo.Check.Warning.OperationOnSameValues},
114+
{Credo.Check.Warning.OperationWithConstantResult},
115+
{Credo.Check.Warning.UnusedEnumOperation},
116+
{Credo.Check.Warning.UnusedFileOperation},
117+
{Credo.Check.Warning.UnusedKeywordOperation},
118+
{Credo.Check.Warning.UnusedListOperation},
119+
{Credo.Check.Warning.UnusedPathOperation},
120+
{Credo.Check.Warning.UnusedRegexOperation},
121+
{Credo.Check.Warning.UnusedStringOperation},
122+
{Credo.Check.Warning.UnusedTupleOperation},
123+
124+
# Custom checks can be created using `mix credo.gen.check`.
125+
#
126+
]
127+
}
128+
]
129+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
_build
22
deps
3+
doc

mix.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ defmodule ElixirStyleGuide.Mixfile do
1515
end
1616

1717
defp deps do
18-
[]
18+
[{:ex_doc, ">= 0.0.0", only: :dev},
19+
{:credo, "~> 0.5", only: [:dev, :test]}]
1920
end
2021
end

mix.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
%{"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], []},
2+
"credo": {:hex, :credo, "0.6.1", "a941e2591bd2bd2055dc92b810c174650b40b8290459c89a835af9d59ac4a5f8", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, optional: false]}]},
3+
"earmark": {:hex, :earmark, "1.1.1", "433136b7f2e99cde88b745b3a0cfc3fbc81fe58b918a09b40fce7f00db4d8187", [:mix], []},
4+
"ex_doc": {:hex, :ex_doc, "0.15.0", "e73333785eef3488cf9144a6e847d3d647e67d02bd6fdac500687854dd5c599f", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, optional: false]}]}}

0 commit comments

Comments
 (0)