Skip to content

Commit 796dc94

Browse files
authored
Prep for hex publishing (#2)
* linting deps * test workflow * release workflow * only test on 1.18 * package info * docs * ex doc * changelog * moduledocs * rename behaviour Continuous -> ContinuousPDF * rename file * optional callbacks * credo * dialyzer * specs for normal dist * ignore Rust NIF calls in test coverage * delete vscode config * sobelow * elixir wrapper module should not be referenced directly * update package and docs links
1 parent 96101fb commit 796dc94

File tree

19 files changed

+594
-41
lines changed

19 files changed

+594
-41
lines changed

.credo.exs

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
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: ["lib/", "test/"],
25+
excluded: [
26+
~r"/_build/",
27+
~r"/deps/",
28+
"test/support/"
29+
]
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: true,
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.MultiAliasImportRequireUse, []},
70+
{Credo.Check.Consistency.ParameterPatternMatching, []},
71+
{Credo.Check.Consistency.SpaceAroundOperators, []},
72+
{Credo.Check.Consistency.SpaceInParentheses, []},
73+
{Credo.Check.Consistency.TabsOrSpaces, [force: :spaces]},
74+
{Credo.Check.Consistency.UnusedVariableNames, [force: :meaningful]},
75+
76+
#
77+
## Design Checks
78+
#
79+
# You can customize the priority of any check
80+
# Priority values are: `low, normal, high, higher`
81+
#
82+
{Credo.Check.Design.AliasUsage,
83+
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
84+
# You can also customize the exit_status of each check.
85+
# If you don't want TODO comments to cause `mix credo` to fail, just
86+
# set this value to 0 (zero).
87+
#
88+
{Credo.Check.Design.TagTODO, [exit_status: 2]},
89+
{Credo.Check.Design.TagFIXME, []},
90+
91+
#
92+
## Readability Checks
93+
#
94+
{Credo.Check.Readability.AliasOrder, []},
95+
{Credo.Check.Readability.FunctionNames, []},
96+
{Credo.Check.Readability.LargeNumbers, []},
97+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
98+
{Credo.Check.Readability.ModuleAttributeNames, []},
99+
{Credo.Check.Readability.ModuleDoc,
100+
[
101+
ignore_names:
102+
~r/(\.\w+Controller|\.Endpoint|\.\w+Live(\.\w+)?|\.Repo|\.Router|\.\w+Socket|\.\w+View|\.\w+Test|\.\w+Telemetry|\.\w+RecipeLive)$/
103+
]},
104+
{Credo.Check.Readability.ModuleNames, []},
105+
{Credo.Check.Readability.ParenthesesInCondition, []},
106+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
107+
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
108+
{Credo.Check.Readability.PredicateFunctionNames, []},
109+
{Credo.Check.Readability.PreferImplicitTry, []},
110+
{Credo.Check.Readability.RedundantBlankLines, []},
111+
{Credo.Check.Readability.Semicolons, []},
112+
{Credo.Check.Readability.SpaceAfterCommas, []},
113+
{Credo.Check.Readability.StrictModuleLayout,
114+
[ignore_module_attributes: ~w/transform_description/a]},
115+
{Credo.Check.Readability.StringSigils, []},
116+
{Credo.Check.Readability.Specs, []},
117+
{Credo.Check.Readability.TrailingBlankLine, []},
118+
{Credo.Check.Readability.TrailingWhiteSpace, []},
119+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
120+
{Credo.Check.Readability.VariableNames, []},
121+
{Credo.Check.Readability.WithSingleClause, []},
122+
{Credo.Check.Readability.ImplTrue, []},
123+
{Credo.Check.Readability.SeparateAliasRequire, []},
124+
125+
#
126+
## Refactoring Opportunities
127+
#
128+
{Credo.Check.Refactor.Apply, []},
129+
{Credo.Check.Refactor.CondStatements, []},
130+
{Credo.Check.Refactor.CyclomaticComplexity, []},
131+
{Credo.Check.Refactor.FunctionArity, []},
132+
{Credo.Check.Refactor.LongQuoteBlocks, []},
133+
{Credo.Check.Refactor.MatchInCondition, []},
134+
{Credo.Check.Refactor.MapJoin, []},
135+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
136+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
137+
{Credo.Check.Refactor.Nesting, []},
138+
{Credo.Check.Refactor.UnlessWithElse, []},
139+
{Credo.Check.Refactor.WithClauses, []},
140+
{Credo.Check.Refactor.FilterFilter, []},
141+
{Credo.Check.Refactor.RejectReject, []},
142+
{Credo.Check.Refactor.RedundantWithClauseResult, []},
143+
144+
#
145+
## Warnings
146+
#
147+
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
148+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
149+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
150+
{Credo.Check.Warning.IExPry, []},
151+
{Credo.Check.Warning.IoInspect, []},
152+
{Credo.Check.Warning.OperationOnSameValues, []},
153+
{Credo.Check.Warning.OperationWithConstantResult, []},
154+
{Credo.Check.Warning.RaiseInsideRescue, []},
155+
{Credo.Check.Warning.SpecWithStruct, []},
156+
{Credo.Check.Warning.WrongTestFileExtension, []},
157+
{Credo.Check.Warning.UnusedEnumOperation, []},
158+
{Credo.Check.Warning.UnusedFileOperation, []},
159+
{Credo.Check.Warning.UnusedKeywordOperation, []},
160+
{Credo.Check.Warning.UnusedListOperation, []},
161+
{Credo.Check.Warning.UnusedPathOperation, []},
162+
{Credo.Check.Warning.UnusedRegexOperation, []},
163+
{Credo.Check.Warning.UnusedStringOperation, []},
164+
{Credo.Check.Warning.UnusedTupleOperation, []},
165+
{Credo.Check.Warning.UnsafeToAtom, []}
166+
],
167+
disabled: [
168+
#
169+
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)
170+
171+
#
172+
# Controversial and experimental checks (opt-in, just move the check to `:enabled`
173+
# and be sure to use `mix credo --strict` to see low priority checks)
174+
#
175+
{Credo.Check.Design.DuplicatedCode, []},
176+
{Credo.Check.Design.SkipTestWithoutComment, []},
177+
{Credo.Check.Readability.AliasAs, []},
178+
{Credo.Check.Readability.BlockPipe, []},
179+
{Credo.Check.Readability.MultiAlias, []},
180+
{Credo.Check.Readability.NestedFunctionCalls, []},
181+
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
182+
{Credo.Check.Readability.SinglePipe, []},
183+
{Credo.Check.Readability.WithCustomTaggedTuple, []},
184+
{Credo.Check.Refactor.ABCSize, []},
185+
{Credo.Check.Refactor.AppendSingleItem, []},
186+
{Credo.Check.Refactor.DoubleBooleanNegation, []},
187+
{Credo.Check.Refactor.FilterReject, []},
188+
{Credo.Check.Refactor.IoPuts, []},
189+
{Credo.Check.Refactor.MapMap, []},
190+
{Credo.Check.Refactor.ModuleDependencies, []},
191+
{Credo.Check.Refactor.NegatedIsNil, []},
192+
{Credo.Check.Refactor.PipeChainStart, []},
193+
{Credo.Check.Refactor.RejectFilter, []},
194+
{Credo.Check.Refactor.VariableRebinding, []},
195+
{Credo.Check.Warning.LazyLogging, []},
196+
{Credo.Check.Warning.LeakyEnvironment, []},
197+
{Credo.Check.Warning.MapGetUnsafePass, []},
198+
{Credo.Check.Warning.MixEnv, []}
199+
200+
# {Credo.Check.Refactor.MapInto, []},
201+
202+
#
203+
# Custom checks can be created using `mix credo.gen.check`.
204+
#
205+
]
206+
}
207+
}
208+
]
209+
}
210+

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
publish:
7+
name: Publish
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: erlef/setup-beam@v1
12+
with:
13+
elixir-version: 1.18
14+
otp-version: 27.2
15+
- name: Fetch dependencies
16+
run: mix deps.get
17+
- name: Publish package
18+
env:
19+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
20+
run: mix hex.publish --organization ${{ vars.HEX_ORG }} --replace --yes

.github/workflows/test.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Test
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
jobs:
8+
test:
9+
name: Test (Elixir ${{ matrix.elixir }} | OTP ${{ matrix.otp }})
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- elixir: 1.18.x
16+
otp: 27
17+
os: ubuntu-22.04
18+
env:
19+
MIX_ENV: test
20+
steps:
21+
- name: Setup Elixir
22+
uses: erlef/setup-beam@v1
23+
with:
24+
elixir-version: ${{ matrix.elixir }}
25+
otp-version: ${{ matrix.otp }}
26+
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Cache dependencies
31+
uses: actions/cache@v4
32+
id: cache-deps
33+
with:
34+
path: |
35+
deps
36+
_build
37+
key: |
38+
mix-${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
39+
restore-keys: |
40+
mix-${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-
41+
- name: Install dependencies
42+
env:
43+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
44+
run: mix deps.get
45+
46+
- name: Compile
47+
run: mix compile --warnings-as-errors
48+
49+
- name: Check for unused packages
50+
run: mix deps.unlock --check-unused
51+
52+
- run: mix format --check-formatted
53+
54+
- run: mix credo --strict
55+
56+
- run: mix dialyzer
57+
58+
- name: Check for abandonded packages
59+
run: mix hex.audit
60+
61+
- name: Check outdated dependencies
62+
run: mix hex.outdated --within-requirements || true
63+
64+
- name: Check for vulnerable packages
65+
run: mix hex.audit
66+
67+
- name: Run tests
68+
run: mix test
69+
70+
- name: Run tests (with coverage)
71+
run: mix test --cover --export-coverage default
72+
73+
- name: Check coverage
74+
run: mix test.coverage
75+
76+
- name: Scan for security vulnerabilities
77+
run: mix sobelow --exit --threshold medium
78+
79+
publish:
80+
name: Publish
81+
runs-on: ubuntu-22.04
82+
steps:
83+
- uses: actions/checkout@v4
84+
- uses: erlef/setup-beam@v1
85+
with:
86+
elixir-version: 1.18
87+
otp-version: 27.2
88+
- name: Fetch dependencies
89+
run: mix deps.get
90+
- name: Publish package
91+
env:
92+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
93+
run: mix hex.publish --organization ${{ vars.HEX_ORG }} --dry-run --replace --yes

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.zed/settings.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## v0.1.0
4+
5+
- Initial release.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Exstatic
22

3-
[![Hex.pm](https://img.shields.io/hexpm/v/exstatic.svg)](https://hex.pm/packages/exstatic)
4-
[![Docs](https://img.shields.io/badge/hex-docs-blue.svg)](https://hexdocs.pm/exstatic)
3+
[![Hex.pm](https://img.shields.io/hexpm/v/exstatic.svg)](https://hex.pm/packages/zappi/exstatic)
4+
[![Docs](https://img.shields.io/badge/hex-docs-blue.svg)](https://zappi.hexdocs.pm/exstatic)
55

66
Exstatic provides idiomatic Elixir interfaces for working with statistical distributions. Built on top of the battle-tested [statrs](https://docs.rs/statrs) Rust library, it combines Elixir's elegant syntax with Rust's numerical computing capabilities.
77

@@ -34,7 +34,7 @@ Normal.variance(dist) # => 1.0
3434

3535
### Requirements
3636

37-
- Elixir ~> 1.17
37+
- Elixir ~> 1.18
3838

3939
Precompiled NIF binaries are included for common platforms. No additional system dependencies are required for normal usage.
4040

@@ -56,7 +56,7 @@ Full documentation can be found at [https://hexdocs.pm/exstatic](https://hexdocs
5656

5757
### Requirements
5858

59-
- Elixir ~> 1.17
59+
- Elixir ~> 1.18
6060
- Rust (for compiling NIFs)
6161

6262
### Setup

lib/exstatic/continuous.ex

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)