Skip to content

Commit 0001046

Browse files
fix: broken exchange algorithm (#60)
Co-authored-by: João Lobo <joao@lobo.is>
1 parent ed15b04 commit 0001046

File tree

4 files changed

+389
-12
lines changed

4 files changed

+389
-12
lines changed

.credo.exs

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
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+
"test/",
27+
"priv/repo/"
28+
],
29+
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
30+
},
31+
#
32+
# Load and configure plugins here:
33+
#
34+
plugins: [],
35+
#
36+
# If you create your own checks, you must specify the source files for
37+
# them here, so they can be loaded by Credo before running the analysis.
38+
#
39+
requires: [],
40+
#
41+
# If you want to enforce a style guide and need a more traditional linting
42+
# experience, you can change `strict` to `true` below:
43+
#
44+
strict: false,
45+
#
46+
# To modify the timeout for parsing files, change this value:
47+
#
48+
parse_timeout: 5000,
49+
#
50+
# If you want to use uncolored output by default, you can change `color`
51+
# to `false` below:
52+
#
53+
color: true,
54+
#
55+
# You can customize the parameters of any check by adding a second element
56+
# to the tuple.
57+
#
58+
# To disable a check put `false` as second element:
59+
#
60+
# {Credo.Check.Design.DuplicatedCode, false}
61+
#
62+
checks: %{
63+
enabled: [
64+
#
65+
## Consistency Checks
66+
#
67+
{Credo.Check.Consistency.ExceptionNames, []},
68+
{Credo.Check.Consistency.LineEndings, []},
69+
{Credo.Check.Consistency.ParameterPatternMatching, []},
70+
{Credo.Check.Consistency.SpaceAroundOperators, []},
71+
{Credo.Check.Consistency.SpaceInParentheses, []},
72+
{Credo.Check.Consistency.TabsOrSpaces, []},
73+
74+
#
75+
## Design Checks
76+
#
77+
# You can customize the priority of any check
78+
# Priority values are: `low, normal, high, higher`
79+
#
80+
{Credo.Check.Design.AliasUsage,
81+
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
82+
{Credo.Check.Design.TagTODO, false},
83+
{Credo.Check.Design.TagFIXME, false},
84+
85+
#
86+
## Readability Checks
87+
#
88+
{Credo.Check.Readability.AliasOrder, []},
89+
{Credo.Check.Readability.FunctionNames, []},
90+
{Credo.Check.Readability.LargeNumbers, []},
91+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
92+
{Credo.Check.Readability.ModuleAttributeNames, []},
93+
{Credo.Check.Readability.ModuleDoc, []},
94+
{Credo.Check.Readability.ModuleNames, []},
95+
{Credo.Check.Readability.ParenthesesInCondition, []},
96+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
97+
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
98+
{Credo.Check.Readability.PredicateFunctionNames, []},
99+
{Credo.Check.Readability.PreferImplicitTry, []},
100+
{Credo.Check.Readability.RedundantBlankLines, []},
101+
{Credo.Check.Readability.Semicolons, []},
102+
{Credo.Check.Readability.SpaceAfterCommas, []},
103+
{Credo.Check.Readability.StringSigils, []},
104+
{Credo.Check.Readability.TrailingBlankLine, []},
105+
{Credo.Check.Readability.TrailingWhiteSpace, []},
106+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
107+
{Credo.Check.Readability.VariableNames, []},
108+
{Credo.Check.Readability.WithSingleClause, []},
109+
110+
#
111+
## Refactoring Opportunities
112+
#
113+
{Credo.Check.Refactor.Apply, []},
114+
{Credo.Check.Refactor.CondStatements, []},
115+
{Credo.Check.Refactor.CyclomaticComplexity, [max_complexity: 10]},
116+
{Credo.Check.Refactor.FunctionArity, []},
117+
{Credo.Check.Refactor.LongQuoteBlocks, []},
118+
{Credo.Check.Refactor.MatchInCondition, []},
119+
{Credo.Check.Refactor.MapJoin, []},
120+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
121+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
122+
{Credo.Check.Refactor.Nesting, [max_nesting: 3]},
123+
{Credo.Check.Refactor.UnlessWithElse, []},
124+
{Credo.Check.Refactor.WithClauses, []},
125+
{Credo.Check.Refactor.FilterCount, []},
126+
{Credo.Check.Refactor.FilterFilter, []},
127+
{Credo.Check.Refactor.RejectReject, []},
128+
{Credo.Check.Refactor.RedundantWithClauseResult, []},
129+
130+
#
131+
## Warnings
132+
#
133+
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
134+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
135+
{Credo.Check.Warning.Dbg, []},
136+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
137+
{Credo.Check.Warning.IExPry, []},
138+
{Credo.Check.Warning.IoInspect, []},
139+
{Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []},
140+
{Credo.Check.Warning.OperationOnSameValues, []},
141+
{Credo.Check.Warning.OperationWithConstantResult, []},
142+
{Credo.Check.Warning.RaiseInsideRescue, []},
143+
{Credo.Check.Warning.SpecWithStruct, []},
144+
{Credo.Check.Warning.WrongTestFileExtension, []},
145+
{Credo.Check.Warning.UnusedEnumOperation, []},
146+
{Credo.Check.Warning.UnusedFileOperation, []},
147+
{Credo.Check.Warning.UnusedKeywordOperation, []},
148+
{Credo.Check.Warning.UnusedListOperation, []},
149+
{Credo.Check.Warning.UnusedPathOperation, []},
150+
{Credo.Check.Warning.UnusedRegexOperation, []},
151+
{Credo.Check.Warning.UnusedStringOperation, []},
152+
{Credo.Check.Warning.UnusedTupleOperation, []},
153+
{Credo.Check.Warning.UnsafeExec, []}
154+
],
155+
disabled: [
156+
#
157+
# Controversial and experimental checks (opt-in, just move the check to `:enabled`
158+
# and be sure to use `mix credo --strict` to see low priority checks)
159+
#
160+
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
161+
{Credo.Check.Consistency.UnusedVariableNames, []},
162+
{Credo.Check.Design.DuplicatedCode, []},
163+
{Credo.Check.Design.SkipTestWithoutComment, []},
164+
{Credo.Check.Readability.AliasAs, []},
165+
{Credo.Check.Readability.BlockPipe, []},
166+
{Credo.Check.Readability.ImplTrue, []},
167+
{Credo.Check.Readability.MultiAlias, []},
168+
{Credo.Check.Readability.NestedFunctionCalls, []},
169+
{Credo.Check.Readability.OneArityFunctionInPipe, []},
170+
{Credo.Check.Readability.SeparateAliasRequire, []},
171+
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
172+
{Credo.Check.Readability.SinglePipe, []},
173+
{Credo.Check.Readability.Specs, []},
174+
{Credo.Check.Readability.StrictModuleLayout, []},
175+
{Credo.Check.Readability.WithCustomTaggedTuple, []},
176+
{Credo.Check.Readability.OnePipePerLine, []},
177+
{Credo.Check.Refactor.ABCSize, []},
178+
{Credo.Check.Refactor.AppendSingleItem, []},
179+
{Credo.Check.Refactor.DoubleBooleanNegation, []},
180+
{Credo.Check.Refactor.FilterReject, []},
181+
{Credo.Check.Refactor.IoPuts, []},
182+
{Credo.Check.Refactor.MapMap, []},
183+
{Credo.Check.Refactor.ModuleDependencies, []},
184+
{Credo.Check.Refactor.NegatedIsNil, []},
185+
{Credo.Check.Refactor.PassAsyncInTestCases, []},
186+
{Credo.Check.Refactor.PipeChainStart, []},
187+
{Credo.Check.Refactor.RejectFilter, []},
188+
{Credo.Check.Refactor.VariableRebinding, []},
189+
{Credo.Check.Warning.LazyLogging, []},
190+
{Credo.Check.Warning.LeakyEnvironment, []},
191+
{Credo.Check.Warning.MapGetUnsafePass, []},
192+
{Credo.Check.Warning.MixEnv, []},
193+
{Credo.Check.Warning.UnsafeToAtom, []}
194+
195+
# {Credo.Check.Refactor.MapInto, []},
196+
197+
#
198+
# Custom checks can be created using `mix credo.gen.check`.
199+
#
200+
]
201+
}
202+
}
203+
]
204+
}

config/config.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ config :atlas, Oban,
5151
imports: 1,
5252
exchanges: 1,
5353
schedule_generator: 1
54+
],
55+
plugins: [
56+
{Oban.Plugins.Cron,
57+
crontab: [
58+
# Run every 5 minutes
59+
{"*/5 * * * *", Atlas.Workers.ShiftExchange}
60+
]}
5461
]
5562

5663
# Import environment specific config. This must remain at the bottom

0 commit comments

Comments
 (0)