Skip to content

Commit cd37656

Browse files
committed
Merge branch 'release/0.2.0'
2 parents b972eb8 + 8a358cb commit cd37656

File tree

15 files changed

+830
-299
lines changed

15 files changed

+830
-299
lines changed

.check.exs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Check if the version used by the runner is currently the last supported
2+
# version, that is: the version used in the Nix shell on development machines.
3+
last_supported_version? =
4+
System.version()
5+
|> Version.parse!()
6+
|> Version.match?("~> 1.10.0")
7+
8+
[
9+
skipped: false,
10+
tools: [
11+
{:compiler, "mix compile --force --verbose --warnings-as-errors"},
12+
{:ex_unit, "mix test --trace"},
13+
14+
# Run the formatter and ex_doc only for the last supported version. This
15+
# avoids errors in CI when the formatting changes or ex_doc is not
16+
# compatible with an old Elixir version.
17+
{:formatter, last_supported_version?},
18+
{:ex_doc, last_supported_version?},
19+
20+
# Check for unused dependencies in the mix.lock.
21+
{:unused_deps, "mix deps.unlock --check-unused",
22+
enabled: last_supported_version?}
23+
]
24+
]

.credo.exs

Lines changed: 109 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
configs: [
1111
%{
1212
#
13-
# Run any exec using `mix credo -C <name>`. If no exec name is given
13+
# Run any config using `mix credo -C <name>`. If no config name is given
1414
# "default" is used.
1515
#
1616
name: "default",
@@ -21,10 +21,23 @@
2121
# You can give explicit globs or simply directories.
2222
# In the latter case `**/*.{ex,exs}` will be used.
2323
#
24-
included: ["lib/", "src/", "test/", "web/", "apps/"],
24+
included: [
25+
"lib/",
26+
"src/",
27+
"test/",
28+
"web/",
29+
"apps/*/lib/",
30+
"apps/*/src/",
31+
"apps/*/test/",
32+
"apps/*/web/"
33+
],
2534
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
2635
},
2736
#
37+
# Load and configure plugins here:
38+
#
39+
plugins: [],
40+
#
2841
# If you create your own checks, you must specify the source files for
2942
# them here, so they can be loaded by Credo before running the analysis.
3043
#
@@ -35,6 +48,10 @@
3548
#
3649
strict: true,
3750
#
51+
# To modify the timeout for parsing files, change this value:
52+
#
53+
parse_timeout: 5000,
54+
#
3855
# If you want to use uncolored output by default, you can change `color`
3956
# to `false` below:
4057
#
@@ -51,107 +68,126 @@
5168
#
5269
## Consistency Checks
5370
#
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},
71+
{Credo.Check.Consistency.ExceptionNames, []},
72+
{Credo.Check.Consistency.LineEndings, []},
73+
{Credo.Check.Consistency.ParameterPatternMatching, []},
74+
{Credo.Check.Consistency.SpaceAroundOperators, []},
75+
{Credo.Check.Consistency.SpaceInParentheses, []},
76+
{Credo.Check.Consistency.TabsOrSpaces, []},
6077

6178
#
6279
## Design Checks
6380
#
6481
# You can customize the priority of any check
6582
# Priority values are: `low, normal, high, higher`
6683
#
67-
{Credo.Check.Design.AliasUsage, priority: :low},
68-
# For some checks, you can also set other parameters
69-
#
70-
# If you don't want the `setup` and `test` macro calls in ExUnit tests
71-
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
72-
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
73-
#
74-
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
84+
{Credo.Check.Design.AliasUsage,
85+
[
86+
priority: :low,
87+
if_nested_deeper_than: 2,
88+
if_called_more_often_than: 0
89+
]},
7590
# You can also customize the exit_status of each check.
7691
# If you don't want TODO comments to cause `mix credo` to fail, just
7792
# set this value to 0 (zero).
7893
#
79-
{Credo.Check.Design.TagTODO, exit_status: 0},
80-
{Credo.Check.Design.TagFIXME},
94+
{Credo.Check.Design.TagTODO, [exit_status: 0]},
95+
{Credo.Check.Design.TagFIXME, []},
8196

8297
#
8398
## Readability Checks
8499
#
85-
{Credo.Check.Readability.AliasOrder},
86-
{Credo.Check.Readability.FunctionNames},
87-
{Credo.Check.Readability.LargeNumbers},
88-
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80},
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},
97-
{Credo.Check.Readability.StringSigils},
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},
100+
{Credo.Check.Readability.AliasOrder, []},
101+
{Credo.Check.Readability.FunctionNames, []},
102+
{Credo.Check.Readability.LargeNumbers, []},
103+
{Credo.Check.Readability.MaxLineLength,
104+
[priority: :low, max_length: 80]},
105+
{Credo.Check.Readability.ModuleAttributeNames, []},
106+
{Credo.Check.Readability.ModuleDoc, []},
107+
{Credo.Check.Readability.ModuleNames, []},
108+
{Credo.Check.Readability.ParenthesesInCondition, []},
109+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
110+
{Credo.Check.Readability.PredicateFunctionNames, []},
111+
{Credo.Check.Readability.PreferImplicitTry, []},
112+
{Credo.Check.Readability.RedundantBlankLines, []},
113+
{Credo.Check.Readability.Semicolons, []},
114+
{Credo.Check.Readability.SpaceAfterCommas, []},
115+
{Credo.Check.Readability.StringSigils, []},
116+
{Credo.Check.Readability.TrailingBlankLine, []},
117+
{Credo.Check.Readability.TrailingWhiteSpace, []},
118+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
119+
{Credo.Check.Readability.VariableNames, []},
103120

104121
#
105122
## Refactoring Opportunities
106123
#
107-
{Credo.Check.Refactor.DoubleBooleanNegation, false},
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],
119-
excluded_functions: []},
120-
{Credo.Check.Refactor.UnlessWithElse},
124+
{Credo.Check.Refactor.CondStatements, []},
125+
{Credo.Check.Refactor.CyclomaticComplexity, []},
126+
{Credo.Check.Refactor.FunctionArity, []},
127+
{Credo.Check.Refactor.LongQuoteBlocks, []},
128+
{Credo.Check.Refactor.MapInto, false},
129+
{Credo.Check.Refactor.MatchInCondition, []},
130+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
131+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
132+
{Credo.Check.Refactor.Nesting, []},
133+
{Credo.Check.Refactor.UnlessWithElse, []},
134+
{Credo.Check.Refactor.WithClauses, []},
121135

122136
#
123137
## Warnings
124138
#
125-
{Credo.Check.Warning.BoolOperationOnSameValues},
126-
{Credo.Check.Warning.ExpensiveEmptyEnumCheck},
127-
{Credo.Check.Warning.IExPry},
128-
{Credo.Check.Warning.IoInspect},
129-
{Credo.Check.Warning.LazyLogging},
130-
{Credo.Check.Warning.OperationOnSameValues},
131-
{Credo.Check.Warning.OperationWithConstantResult},
132-
{Credo.Check.Warning.UnusedEnumOperation},
133-
{Credo.Check.Warning.UnusedFileOperation},
134-
{Credo.Check.Warning.UnusedKeywordOperation},
135-
{Credo.Check.Warning.UnusedListOperation},
136-
{Credo.Check.Warning.UnusedPathOperation},
137-
{Credo.Check.Warning.UnusedRegexOperation},
138-
{Credo.Check.Warning.UnusedStringOperation},
139-
{Credo.Check.Warning.UnusedTupleOperation},
140-
{Credo.Check.Warning.RaiseInsideRescue},
139+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
140+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
141+
{Credo.Check.Warning.IExPry, []},
142+
{Credo.Check.Warning.IoInspect, []},
143+
{Credo.Check.Warning.LazyLogging, false},
144+
{Credo.Check.Warning.MixEnv, false},
145+
{Credo.Check.Warning.OperationOnSameValues, []},
146+
{Credo.Check.Warning.OperationWithConstantResult, []},
147+
{Credo.Check.Warning.RaiseInsideRescue, []},
148+
{Credo.Check.Warning.UnusedEnumOperation, []},
149+
{Credo.Check.Warning.UnusedFileOperation, []},
150+
{Credo.Check.Warning.UnusedKeywordOperation, []},
151+
{Credo.Check.Warning.UnusedListOperation, []},
152+
{Credo.Check.Warning.UnusedPathOperation, []},
153+
{Credo.Check.Warning.UnusedRegexOperation, []},
154+
{Credo.Check.Warning.UnusedStringOperation, []},
155+
{Credo.Check.Warning.UnusedTupleOperation, []},
156+
{Credo.Check.Warning.UnsafeExec, []},
157+
158+
#
159+
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)
141160

142161
#
143-
# Controversial and experimental checks (opt-in, just remove `, false`)
162+
# Controversial and experimental checks (opt-in, just replace `false` with `[]`)
163+
#
164+
{Credo.Check.Readability.StrictModuleLayout, false},
165+
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
166+
{Credo.Check.Consistency.UnusedVariableNames, false},
167+
# If you don't want the `setup` and `test` macro calls in ExUnit tests
168+
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
169+
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
144170
#
171+
{Credo.Check.Design.DuplicatedCode, [excluded_macros: []]},
172+
{Credo.Check.Readability.AliasAs, false},
173+
{Credo.Check.Readability.MultiAlias, false},
174+
{Credo.Check.Readability.Specs, false},
175+
{Credo.Check.Readability.SinglePipe, false},
176+
{Credo.Check.Readability.WithCustomTaggedTuple, false},
145177
{Credo.Check.Refactor.ABCSize, false},
146178
{Credo.Check.Refactor.AppendSingleItem, false},
179+
{Credo.Check.Refactor.DoubleBooleanNegation, false},
180+
{Credo.Check.Refactor.ModuleDependencies, false},
181+
{Credo.Check.Refactor.NegatedIsNil, false},
182+
{Credo.Check.Refactor.PipeChainStart,
183+
[
184+
excluded_argument_types: [:atom, :binary, :fn, :keyword],
185+
excluded_functions: []
186+
]},
147187
{Credo.Check.Refactor.VariableRebinding, false},
188+
{Credo.Check.Warning.LeakyEnvironment, false},
148189
{Credo.Check.Warning.MapGetUnsafePass, false},
149-
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
150-
151-
#
152-
# Deprecated checks (these will be deleted after a grace period)
153-
#
154-
{Credo.Check.Readability.Specs, false}
190+
{Credo.Check.Warning.UnsafeToAtom, false}
155191

156192
#
157193
# Custom checks can be created using `mix credo.gen.check`.

.formatter.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
locals_without_parens = [field: 2, field: 3]
1+
locals_without_parens = [field: 2, field: 3, plugin: 1, plugin: 2]
22

33
[
44
inputs: [

.travis.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
sudo: false
21
language: elixir
3-
elixir:
4-
- 1.6.6
5-
- 1.7.4
6-
otp_release:
7-
- 19.3
8-
- 20.3
9-
- 21.1
2+
matrix:
3+
include:
4+
- elixir: 1.6
5+
otp_release: 20.3
6+
- elixir: 1.7
7+
otp_release: 22.3
8+
- elixir: 1.8
9+
otp_release: 22.3
10+
- elixir: 1.9
11+
otp_release: 22.3
12+
- elixir: 1.10
13+
otp_release: 22.3
14+
- elixir: 1.10
15+
otp_release: 23.0
1016
env:
1117
- PLT_DIR=$HOME/.plt
1218
before_script:
@@ -15,11 +21,7 @@ before_script:
1521
- MIX_ENV=test mix deps.compile
1622
- travis_wait mix dialyzer --plt
1723
script:
18-
- mix compile --force --verbose --warnings-as-errors
19-
- mix test --trace
20-
- mix dialyzer --no-compile --no-check --halt-exit-status
21-
- mix credo
22-
- if [[ "$TRAVIS_ELIXIR_VERSION" == "1.7.4" ]]; then mix format --check-formatted; fi
24+
- mix check
2325
cache:
2426
directories:
2527
- $PLT_DIR

0 commit comments

Comments
 (0)