Skip to content

Commit 39021cd

Browse files
authored
Merge pull request #221 from devinus/develop
2 parents da3393f + de73e04 commit 39021cd

25 files changed

+635
-535
lines changed

.credo.exs

Lines changed: 145 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@
2222
# In the latter case `**/*.{ex,exs}` will be used.
2323
#
2424
included: [
25+
"{.credo,.dialyzer_ignore,.formatter,mix}.exs",
26+
"config/",
27+
"bench/",
2528
"lib/",
26-
"src/",
27-
"test/",
28-
"web/",
29-
"apps/*/lib/",
30-
"apps/*/src/",
31-
"apps/*/test/",
32-
"apps/*/web/"
29+
"profile/",
30+
"test/"
3331
],
34-
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
32+
excluded: [~r"/_build/", ~r"/deps/"]
3533
},
3634
#
3735
# Load and configure plugins here:
@@ -64,126 +62,151 @@
6462
#
6563
# {Credo.Check.Design.DuplicatedCode, false}
6664
#
67-
checks: [
68-
#
69-
## Consistency Checks
70-
#
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, []},
65+
checks: %{
66+
enabled: [
67+
#
68+
## Consistency Checks
69+
#
70+
{Credo.Check.Consistency.ExceptionNames, []},
71+
{Credo.Check.Consistency.LineEndings, []},
72+
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
73+
{Credo.Check.Consistency.ParameterPatternMatching, []},
74+
{Credo.Check.Consistency.SpaceAroundOperators, []},
75+
{Credo.Check.Consistency.SpaceInParentheses, []},
76+
{Credo.Check.Consistency.TabsOrSpaces, []},
7777

78-
#
79-
## Design Checks
80-
#
81-
# You can customize the priority of any check
82-
# Priority values are: `low, normal, high, higher`
83-
#
84-
{Credo.Check.Design.AliasUsage,
85-
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
86-
# You can also customize the exit_status of each check.
87-
# If you don't want TODO comments to cause `mix credo` to fail, just
88-
# set this value to 0 (zero).
89-
#
90-
{Credo.Check.Design.TagTODO, [exit_status: 2]},
91-
{Credo.Check.Design.TagFIXME, []},
78+
#
79+
## Design Checks
80+
#
81+
# You can customize the priority of any check
82+
# Priority values are: `low, normal, high, higher`
83+
#
84+
{Credo.Check.Design.AliasUsage,
85+
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
86+
{Credo.Check.Design.DuplicatedCode, []},
87+
{Credo.Check.Design.SkipTestWithoutComment, []},
88+
{Credo.Check.Design.TagFIXME, []},
89+
# You can also customize the exit_status of each check.
90+
# If you don't want TODO comments to cause `mix credo` to fail, just
91+
# set this value to 0 (zero).
92+
#
93+
{Credo.Check.Design.TagTODO, [exit_status: 2]},
9294

93-
#
94-
## Readability Checks
95-
#
96-
{Credo.Check.Readability.AliasOrder, []},
97-
{Credo.Check.Readability.FunctionNames, []},
98-
{Credo.Check.Readability.LargeNumbers, []},
99-
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
100-
{Credo.Check.Readability.ModuleAttributeNames, []},
101-
{Credo.Check.Readability.ModuleDoc, []},
102-
{Credo.Check.Readability.ModuleNames, []},
103-
{Credo.Check.Readability.ParenthesesInCondition, []},
104-
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
105-
{Credo.Check.Readability.PredicateFunctionNames, []},
106-
{Credo.Check.Readability.PreferImplicitTry, []},
107-
{Credo.Check.Readability.RedundantBlankLines, []},
108-
{Credo.Check.Readability.Semicolons, []},
109-
{Credo.Check.Readability.SpaceAfterCommas, []},
110-
{Credo.Check.Readability.StringSigils, false},
111-
{Credo.Check.Readability.TrailingBlankLine, []},
112-
{Credo.Check.Readability.TrailingWhiteSpace, []},
113-
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
114-
{Credo.Check.Readability.VariableNames, []},
95+
#
96+
## Readability Checks
97+
#
98+
{Credo.Check.Readability.AliasAs, []},
99+
{Credo.Check.Readability.AliasOrder, []},
100+
{Credo.Check.Readability.BlockPipe, []},
101+
{Credo.Check.Readability.FunctionNames, []},
102+
{Credo.Check.Readability.ImplTrue, []},
103+
{Credo.Check.Readability.LargeNumbers, []},
104+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
105+
{Credo.Check.Readability.ModuleAttributeNames, []},
106+
{Credo.Check.Readability.ModuleDoc, []},
107+
{Credo.Check.Readability.ModuleNames, []},
108+
{Credo.Check.Readability.OneArityFunctionInPipe, []},
109+
{Credo.Check.Readability.ParenthesesInCondition, []},
110+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
111+
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
112+
{Credo.Check.Readability.PredicateFunctionNames, []},
113+
{Credo.Check.Readability.PreferImplicitTry, []},
114+
{Credo.Check.Readability.RedundantBlankLines, []},
115+
{Credo.Check.Readability.Semicolons, []},
116+
{Credo.Check.Readability.SeparateAliasRequire, []},
117+
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
118+
{Credo.Check.Readability.SinglePipe, []},
119+
{Credo.Check.Readability.SpaceAfterCommas, []},
120+
{Credo.Check.Readability.StrictModuleLayout, []},
121+
{Credo.Check.Readability.StringSigils, []},
122+
{Credo.Check.Readability.TrailingBlankLine, []},
123+
{Credo.Check.Readability.TrailingWhiteSpace, []},
124+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
125+
{Credo.Check.Readability.VariableNames, []},
126+
{Credo.Check.Readability.WithCustomTaggedTuple, []},
127+
{Credo.Check.Readability.WithSingleClause, []},
115128

116-
#
117-
## Refactoring Opportunities
118-
#
119-
{Credo.Check.Refactor.CondStatements, []},
120-
{Credo.Check.Refactor.CyclomaticComplexity, []},
121-
{Credo.Check.Refactor.FunctionArity, []},
122-
{Credo.Check.Refactor.LongQuoteBlocks, []},
123-
{Credo.Check.Refactor.MapInto, false},
124-
{Credo.Check.Refactor.MatchInCondition, []},
125-
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
126-
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
127-
{Credo.Check.Refactor.Nesting, []},
128-
{Credo.Check.Refactor.UnlessWithElse, []},
129-
{Credo.Check.Refactor.WithClauses, []},
129+
#
130+
## Refactoring Opportunities
131+
#
132+
{Credo.Check.Refactor.ABCSize, []},
133+
{Credo.Check.Refactor.AppendSingleItem, []},
134+
{Credo.Check.Refactor.Apply, []},
135+
{Credo.Check.Refactor.CondStatements, []},
136+
{Credo.Check.Refactor.CyclomaticComplexity, []},
137+
{Credo.Check.Refactor.DoubleBooleanNegation, []},
138+
{Credo.Check.Refactor.FilterCount, []},
139+
{Credo.Check.Refactor.FilterFilter, []},
140+
{Credo.Check.Refactor.FilterReject, []},
141+
{Credo.Check.Refactor.FunctionArity, []},
142+
{Credo.Check.Refactor.IoPuts, []},
143+
{Credo.Check.Refactor.LongQuoteBlocks, []},
144+
{Credo.Check.Refactor.MapJoin, []},
145+
{Credo.Check.Refactor.MapMap, []},
146+
{Credo.Check.Refactor.MatchInCondition, []},
147+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
148+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
149+
{Credo.Check.Refactor.NegatedIsNil, []},
150+
{Credo.Check.Refactor.Nesting, []},
151+
{Credo.Check.Refactor.PassAsyncInTestCases, []},
152+
{Credo.Check.Refactor.PipeChainStart, []},
153+
{Credo.Check.Refactor.RedundantWithClauseResult, []},
154+
{Credo.Check.Refactor.RejectFilter, []},
155+
{Credo.Check.Refactor.RejectReject, []},
156+
{Credo.Check.Refactor.UnlessWithElse, []},
157+
{Credo.Check.Refactor.UtcNowTruncate, []},
158+
{Credo.Check.Refactor.WithClauses, []},
130159

131-
#
132-
## Warnings
133-
#
134-
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
135-
{Credo.Check.Warning.BoolOperationOnSameValues, []},
136-
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
137-
{Credo.Check.Warning.IExPry, []},
138-
{Credo.Check.Warning.IoInspect, []},
139-
{Credo.Check.Warning.LazyLogging, false},
140-
{Credo.Check.Warning.MixEnv, false},
141-
{Credo.Check.Warning.OperationOnSameValues, []},
142-
{Credo.Check.Warning.OperationWithConstantResult, []},
143-
{Credo.Check.Warning.RaiseInsideRescue, []},
144-
{Credo.Check.Warning.UnusedEnumOperation, []},
145-
{Credo.Check.Warning.UnusedFileOperation, []},
146-
{Credo.Check.Warning.UnusedKeywordOperation, []},
147-
{Credo.Check.Warning.UnusedListOperation, []},
148-
{Credo.Check.Warning.UnusedPathOperation, []},
149-
{Credo.Check.Warning.UnusedRegexOperation, []},
150-
{Credo.Check.Warning.UnusedStringOperation, []},
151-
{Credo.Check.Warning.UnusedTupleOperation, []},
152-
{Credo.Check.Warning.UnsafeExec, []},
160+
#
161+
## Warnings
162+
#
163+
{Credo.Check.Consistency.UnusedVariableNames, []},
164+
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
165+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
166+
{Credo.Check.Warning.Dbg, []},
167+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
168+
{Credo.Check.Warning.IExPry, []},
169+
{Credo.Check.Warning.IoInspect, []},
170+
{Credo.Check.Warning.LazyLogging, false},
171+
{Credo.Check.Warning.LeakyEnvironment, []},
172+
{Credo.Check.Warning.MapGetUnsafePass, []},
173+
{Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []},
174+
{Credo.Check.Warning.MixEnv, []},
175+
{Credo.Check.Warning.OperationOnSameValues, []},
176+
{Credo.Check.Warning.OperationWithConstantResult, []},
177+
{Credo.Check.Warning.RaiseInsideRescue, []},
178+
{Credo.Check.Warning.SpecWithStruct, []},
179+
{Credo.Check.Warning.UnsafeExec, []},
180+
{Credo.Check.Warning.UnsafeToAtom, []},
181+
{Credo.Check.Warning.UnusedEnumOperation, []},
182+
{Credo.Check.Warning.UnusedFileOperation, []},
183+
{Credo.Check.Warning.UnusedKeywordOperation, []},
184+
{Credo.Check.Warning.UnusedListOperation, []},
185+
{Credo.Check.Warning.UnusedPathOperation, []},
186+
{Credo.Check.Warning.UnusedRegexOperation, []},
187+
{Credo.Check.Warning.UnusedStringOperation, []},
188+
{Credo.Check.Warning.UnusedTupleOperation, []},
189+
{Credo.Check.Warning.WrongTestFileExtension, []}
190+
],
191+
disabled: [
192+
#
193+
# Controversial and experimental checks (opt-in, just move the check to `:enabled`
194+
# and be sure to use `mix credo --strict` to see low priority checks)
195+
#
196+
{Credo.Check.Readability.MultiAlias, []},
197+
{Credo.Check.Readability.NestedFunctionCalls, []},
198+
{Credo.Check.Readability.OnePipePerLine, []},
199+
{Credo.Check.Readability.Specs, []},
200+
{Credo.Check.Refactor.ModuleDependencies, []},
201+
{Credo.Check.Refactor.VariableRebinding, []}
153202

154-
#
155-
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)
203+
# {Credo.Check.Refactor.MapInto, []},
156204

157-
#
158-
# Controversial and experimental checks (opt-in, just replace `false` with `[]`)
159-
#
160-
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
161-
{Credo.Check.Consistency.UnusedVariableNames, []},
162-
{Credo.Check.Design.DuplicatedCode, []},
163-
{Credo.Check.Readability.AliasAs, []},
164-
{Credo.Check.Readability.BlockPipe, []},
165-
{Credo.Check.Readability.ImplTrue, []},
166-
{Credo.Check.Readability.MultiAlias, false},
167-
{Credo.Check.Readability.SeparateAliasRequire, []},
168-
{Credo.Check.Readability.SinglePipe, []},
169-
{Credo.Check.Readability.Specs, false},
170-
{Credo.Check.Readability.StrictModuleLayout, []},
171-
{Credo.Check.Readability.WithCustomTaggedTuple, []},
172-
{Credo.Check.Refactor.ABCSize, []},
173-
{Credo.Check.Refactor.AppendSingleItem, []},
174-
{Credo.Check.Refactor.DoubleBooleanNegation, []},
175-
{Credo.Check.Refactor.ModuleDependencies, false},
176-
{Credo.Check.Refactor.NegatedIsNil, []},
177-
{Credo.Check.Refactor.PipeChainStart, []},
178-
{Credo.Check.Refactor.VariableRebinding, false},
179-
{Credo.Check.Warning.LeakyEnvironment, []},
180-
{Credo.Check.Warning.MapGetUnsafePass, []},
181-
{Credo.Check.Warning.UnsafeToAtom, []}
182-
183-
#
184-
# Custom checks can be created using `mix credo.gen.check`.
185-
#
186-
]
205+
#
206+
# Custom checks can be created using `mix credo.gen.check`.
207+
#
208+
]
209+
}
187210
}
188211
]
189212
}

.dialyzer_ignore.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[
2-
{"lib/poison/encoder.ex", :unknown_function, 80},
3-
{"lib/poison/decoder.ex", :unknown_function, 106},
42
{"lib/poison/parser.ex", :improper_list_constr}
53
]

.formatter.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[
33
import_deps: [:stream_data],
44
inputs: [
5-
"{mix,.credo,.formatter}.exs",
6-
"{config,lib,test,bench,profile}/**/*.{ex,exs}"
5+
"{.credo,.dialyzer_ignore,.formatter,mix}.exs",
6+
"{config,bench,lib,profile,test}/**/*.{ex,exs}"
77
]
88
]

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/ci.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- master
7+
- develop
78
pull_request:
89
branches:
910
- master
@@ -18,30 +19,32 @@ jobs:
1819
strategy:
1920
matrix:
2021
os:
21-
- ubuntu-latest
22-
- windows-latest
22+
- ubuntu-22.04
2323
- windows-2022
24-
- macos-11
2524
otp:
26-
- '24.1'
27-
- '24.0'
28-
- '23.3'
29-
- '23.2'
30-
- '23.1'
31-
- '23.0'
25+
- "26.2.2"
26+
- "25.3.2"
27+
- "24.3.4"
3228
elixir:
33-
- '1.12.3'
34-
- '1.12.2'
35-
- '1.12.1'
36-
- '1.12.0'
37-
- '1.11.4'
38-
- '1.11.3'
39-
- '1.11.2'
40-
- '1.11.1'
41-
- '1.11.0'
29+
- "1.16.3"
30+
- "1.15.7"
31+
- "1.14.5"
32+
- "1.13.4"
33+
- "1.12.3"
34+
exclude:
35+
- otp: "26.2.2"
36+
elixir: "1.14.5"
37+
- otp: "26.2.2"
38+
elixir: "1.13.4"
39+
- otp: "26.2.2"
40+
elixir: "1.12.3"
41+
- otp: "25.3.2"
42+
elixir: "1.13.4"
43+
- otp: "25.3.2"
44+
elixir: "1.12.3"
4245

4346
steps:
44-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v4
4548
with:
4649
fetch-depth: 0
4750
submodules: true
@@ -51,16 +54,16 @@ jobs:
5154
otp-version: ${{matrix.otp}}
5255
elixir-version: ${{matrix.elixir}}
5356

54-
- uses: actions/cache@v2
55-
id: mix-cache
57+
- uses: actions/cache@v4
58+
id: cache
5659
with:
5760
path: |
5861
_build
5962
deps
6063
vendor
6164
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
6265

63-
- if: steps.mix-cache.outputs.cache-hit != 'true'
66+
- if: steps.cache.outputs.cache-hit != 'true'
6467
run: mix deps.get
6568

6669
- run: mix coveralls.github

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ erl_crash.dump
2222
# Ignore package tarball (built via "mix hex.build").
2323
poison-*.tar
2424

25-
# Temporary files for e.g. tests
26-
/tmp
25+
# Temporary files, for example, from tests.
26+
/tmp/
2727

2828
.elixir_ls
2929
*.benchee

0 commit comments

Comments
 (0)