Skip to content

Commit 38c5934

Browse files
committed
Make it so 🚀
1 parent 52c4174 commit 38c5934

File tree

19 files changed

+1626
-5
lines changed

19 files changed

+1626
-5
lines changed

.credo.exs

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
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+
"src/",
27+
"test/",
28+
"benchmarks/",
29+
"web/",
30+
"apps/*/lib/",
31+
"apps/*/src/",
32+
"apps/*/test/",
33+
"apps/*/web/"
34+
],
35+
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
36+
},
37+
#
38+
# Load and configure plugins here:
39+
#
40+
plugins: [],
41+
#
42+
# If you create your own checks, you must specify the source files for
43+
# them here, so they can be loaded by Credo before running the analysis.
44+
#
45+
requires: [],
46+
#
47+
# If you want to enforce a style guide and need a more traditional linting
48+
# experience, you can change `strict` to `true` below:
49+
#
50+
strict: true,
51+
#
52+
# To modify the timeout for parsing files, change this value:
53+
#
54+
parse_timeout: 5000,
55+
#
56+
# If you want to use uncolored output by default, you can change `color`
57+
# to `false` below:
58+
#
59+
color: true,
60+
#
61+
# You can customize the parameters of any check by adding a second element
62+
# to the tuple.
63+
#
64+
# To disable a check put `false` as second element:
65+
#
66+
# {Credo.Check.Design.DuplicatedCode, false}
67+
#
68+
checks: [
69+
#
70+
## Consistency Checks
71+
#
72+
{Credo.Check.Consistency.ExceptionNames, []},
73+
{Credo.Check.Consistency.LineEndings, []},
74+
{Credo.Check.Consistency.ParameterPatternMatching, []},
75+
{Credo.Check.Consistency.SpaceAroundOperators, []},
76+
{Credo.Check.Consistency.SpaceInParentheses, []},
77+
{Credo.Check.Consistency.TabsOrSpaces, []},
78+
79+
#
80+
## Design Checks
81+
#
82+
# You can customize the priority of any check
83+
# Priority values are: `low, normal, high, higher`
84+
#
85+
{Credo.Check.Design.AliasUsage, [priority: :low]},
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: 0]},
91+
{Credo.Check.Design.TagFIXME, [exit_status: 0]},
92+
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: 100]},
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, []},
111+
{Credo.Check.Readability.TrailingBlankLine, []},
112+
{Credo.Check.Readability.TrailingWhiteSpace, []},
113+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
114+
{Credo.Check.Readability.VariableNames, []},
115+
116+
#
117+
## Refactoring Opportunities
118+
#
119+
{Credo.Check.Refactor.CondStatements, []},
120+
{Credo.Check.Refactor.CyclomaticComplexity, [max_complexity: 40]},
121+
{Credo.Check.Refactor.FunctionArity, []},
122+
{Credo.Check.Refactor.LongQuoteBlocks, [max_line_count: 200]},
123+
# {Credo.Check.Refactor.MapInto, []},
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, []},
130+
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, []},
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, []},
153+
154+
#
155+
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)
156+
157+
#
158+
# Controversial and experimental checks (opt-in, just replace `false` with `[]`)
159+
#
160+
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
161+
{Credo.Check.Consistency.UnusedVariableNames, false},
162+
{Credo.Check.Design.DuplicatedCode, false},
163+
{Credo.Check.Readability.AliasAs, false},
164+
{Credo.Check.Readability.BlockPipe, false},
165+
{Credo.Check.Readability.ImplTrue, false},
166+
{Credo.Check.Readability.MultiAlias, false},
167+
{Credo.Check.Readability.SeparateAliasRequire, false},
168+
{Credo.Check.Readability.SinglePipe, false},
169+
{Credo.Check.Readability.Specs, false},
170+
{Credo.Check.Readability.StrictModuleLayout, false},
171+
{Credo.Check.Readability.WithCustomTaggedTuple, false},
172+
{Credo.Check.Refactor.ABCSize, false},
173+
{Credo.Check.Refactor.AppendSingleItem, false},
174+
{Credo.Check.Refactor.DoubleBooleanNegation, false},
175+
{Credo.Check.Refactor.ModuleDependencies, false},
176+
{Credo.Check.Refactor.NegatedIsNil, false},
177+
{Credo.Check.Refactor.PipeChainStart, false},
178+
{Credo.Check.Refactor.VariableRebinding, false},
179+
{Credo.Check.Warning.LeakyEnvironment, false},
180+
{Credo.Check.Warning.MapGetUnsafePass, false},
181+
{Credo.Check.Warning.UnsafeToAtom, false}
182+
183+
#
184+
# Custom checks can be created using `mix credo.gen.check`.
185+
#
186+
]
187+
}
188+
]
189+
}

.formatter.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Used by "mix format"
2+
[
3+
import_deps: [:nebulex],
4+
inputs: ["{mix,.formatter}.exs", "{config,lib,test,benchmarks}/**/*.{ex,exs}"],
5+
line_length: 100
6+
]

.github/workflows/ci.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
name: >-
14+
Nebulex.Streams Test (Elixir ${{ matrix.elixir }} /
15+
OTP ${{ matrix.otp }} /
16+
OS ${{ matrix.os }})
17+
runs-on: ${{ matrix.os }}
18+
19+
strategy:
20+
matrix:
21+
include:
22+
- elixir: 1.18.x
23+
otp: 27.x
24+
os: 'ubuntu-latest'
25+
style: true
26+
coverage: true
27+
sobelow: true
28+
dialyzer: true
29+
- elixir: 1.17.x
30+
otp: 26.x
31+
os: 'ubuntu-latest'
32+
- elixir: 1.16.x
33+
otp: 26.x
34+
os: 'ubuntu-latest'
35+
36+
env:
37+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
38+
MIX_ENV: test
39+
NEBULEX_PATH: nebulex_streams
40+
41+
steps:
42+
- uses: actions/checkout@v3
43+
44+
- name: Install OTP and Elixir
45+
uses: erlef/setup-beam@v1
46+
with:
47+
otp-version: '${{ matrix.otp }}'
48+
elixir-version: '${{ matrix.elixir }}'
49+
50+
- name: Cache deps
51+
uses: actions/cache@v3
52+
id: mix-cache
53+
with:
54+
path: deps
55+
key: >-
56+
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{
57+
hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
58+
restore-keys: |
59+
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-
60+
61+
- name: Cache _build
62+
uses: actions/cache@v3
63+
with:
64+
path: _build
65+
key: >-
66+
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-${{
67+
hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
68+
restore-keys: |
69+
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-
70+
71+
- name: Install Dependencies
72+
run: |
73+
mix local.hex --force
74+
mix local.rebar --force
75+
mix deps.get
76+
if: ${{ steps.mix-cache.outputs.cache-hit != 'true' }}
77+
78+
- name: Compile code
79+
run: mix compile --warnings-as-errors
80+
81+
- name: Run style and code consistency checks
82+
run: |
83+
mix format --check-formatted
84+
mix credo --strict
85+
if: ${{ matrix.style }}
86+
87+
- name: Run tests
88+
run: mix test --trace
89+
if: ${{ !matrix.coverage }}
90+
91+
- name: Run tests with coverage
92+
run: mix coveralls.github
93+
if: ${{ matrix.coverage }}
94+
95+
- name: Run sobelow
96+
run: mix sobelow --skip --exit Low
97+
if: ${{ matrix.sobelow }}
98+
99+
- name: Restore PLT Cache
100+
uses: actions/cache@v3
101+
id: plt-cache
102+
with:
103+
path: priv/plts
104+
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plt-v1
105+
if: ${{ matrix.dialyzer }}
106+
107+
- name: Create PLTs
108+
run: |
109+
mkdir -p priv/plts
110+
mix dialyzer --plt
111+
if: ${{ matrix.dialyzer && steps.plt-cache.outputs.cache-hit != 'true' }}
112+
113+
- name: Run dialyzer
114+
run: mix dialyzer --format github
115+
if: ${{ matrix.dialyzer && steps.plt-cache.outputs.cache-hit != 'true' }}

.gitignore

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,42 @@
1+
# The directory Mix will write compiled artifacts to.
12
/_build
3+
4+
# If you run "mix test --cover", coverage assets end up here.
25
/cover
6+
7+
# The directory Mix downloads your dependencies sources to.
38
/deps
9+
10+
# Where 3rd-party dependencies like ExDoc output generated docs.
411
/doc
12+
/docs
13+
/benchmarks/output
14+
15+
# Ignore .fetch files in case you like to edit your project deps locally.
516
/.fetch
17+
18+
# Dialyzer
19+
/priv
20+
21+
# If the VM crashes, it generates a dump, let's ignore it too.
622
erl_crash.dump
23+
24+
# Also ignore archive artifacts (built via "mix archive.build").
725
*.ez
26+
27+
# Others
28+
*.o
829
*.beam
9-
/config/*.secret.exs
10-
.elixir_ls/
30+
*.plt
31+
erl_crash.dump
32+
.DS_Store
33+
._*
34+
/tmp*
35+
.elixir*
36+
.vs*
37+
/priv
38+
.sobelow*
39+
/config
40+
Elixir*
41+
/nebulex
42+
/my_app

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
elixir 1.18.2-otp-27
2+
erlang 27.2.1

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 nebulex-project
3+
Copyright (c) 2025 Carlos Andres Bolaños R.A.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)