Skip to content

Commit 456f65f

Browse files
committed
Bootstrap new Elixir Project
1 parent 0bb9cbf commit 456f65f

File tree

12 files changed

+330
-2
lines changed

12 files changed

+330
-2
lines changed

.credo.exs

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
alias Credo.Check
2+
3+
%{
4+
configs: [
5+
%{
6+
name: "default",
7+
files: %{
8+
included: [
9+
"lib/",
10+
"src/",
11+
"test/",
12+
"web/",
13+
"apps/*/lib/",
14+
"apps/*/src/",
15+
"apps/*/test/",
16+
"apps/*/web/"
17+
],
18+
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
19+
},
20+
plugins: [],
21+
requires: [],
22+
strict: true,
23+
parse_timeout: 5000,
24+
color: true,
25+
checks: %{
26+
enabled: [
27+
## Consistency Checks ------------------------------------------------
28+
{Check.Consistency.ExceptionNames, []},
29+
{Check.Consistency.LineEndings, []},
30+
{Check.Consistency.ParameterPatternMatching, []},
31+
{Check.Consistency.SpaceAroundOperators, []},
32+
{Check.Consistency.SpaceInParentheses, []},
33+
{Check.Consistency.TabsOrSpaces, []},
34+
35+
## Design Checks -----------------------------------------------------
36+
{Check.Design.AliasUsage, if_nested_deeper_than: 2},
37+
38+
## Readability Checks ------------------------------------------------
39+
{Check.Readability.AliasOrder, []},
40+
{Check.Readability.FunctionNames, []},
41+
{Check.Readability.LargeNumbers, []},
42+
{Check.Readability.MaxLineLength, priority: :low, max_length: 120},
43+
{Check.Readability.ModuleAttributeNames, []},
44+
{Check.Readability.ModuleDoc, []},
45+
{Check.Readability.ModuleNames, []},
46+
{Check.Readability.ParenthesesInCondition, []},
47+
{Check.Readability.ParenthesesOnZeroArityDefs, []},
48+
{Check.Readability.PipeIntoAnonymousFunctions, []},
49+
{Check.Readability.PredicateFunctionNames, []},
50+
{Check.Readability.PreferImplicitTry, []},
51+
{Check.Readability.RedundantBlankLines, []},
52+
{Check.Readability.Semicolons, []},
53+
{Check.Readability.SpaceAfterCommas, []},
54+
{Check.Readability.StringSigils, []},
55+
{Check.Readability.TrailingBlankLine, []},
56+
{Check.Readability.TrailingWhiteSpace, []},
57+
{Check.Readability.UnnecessaryAliasExpansion, []},
58+
{Check.Readability.VariableNames, []},
59+
{Check.Readability.WithSingleClause, []},
60+
61+
## Refactoring Opportunities -----------------------------------------
62+
{Check.Refactor.Apply, []},
63+
{Check.Refactor.CondStatements, []},
64+
{Check.Refactor.CyclomaticComplexity, []},
65+
{Check.Refactor.FunctionArity, []},
66+
{Check.Refactor.LongQuoteBlocks, []},
67+
{Check.Refactor.MatchInCondition, []},
68+
{Check.Refactor.MapJoin, []},
69+
{Check.Refactor.NegatedConditionsInUnless, []},
70+
{Check.Refactor.NegatedConditionsWithElse, []},
71+
{Check.Refactor.Nesting, []},
72+
{Check.Refactor.UnlessWithElse, []},
73+
{Check.Refactor.WithClauses, []},
74+
{Check.Refactor.FilterFilter, []},
75+
{Check.Refactor.RejectReject, []},
76+
{Check.Refactor.RedundantWithClauseResult, []},
77+
78+
## Warnings ----------------------------------------------------------
79+
{Check.Warning.ApplicationConfigInModuleAttribute, []},
80+
{Check.Warning.BoolOperationOnSameValues, []},
81+
{Check.Warning.ExpensiveEmptyEnumCheck, []},
82+
{Check.Warning.IExPry, []},
83+
{Check.Warning.IoInspect, []},
84+
{Check.Warning.OperationOnSameValues, []},
85+
{Check.Warning.OperationWithConstantResult, []},
86+
{Check.Warning.RaiseInsideRescue, []},
87+
{Check.Warning.SpecWithStruct, []},
88+
{Check.Warning.WrongTestFileExtension, []},
89+
{Check.Warning.UnusedEnumOperation, []},
90+
{Check.Warning.UnusedFileOperation, []},
91+
{Check.Warning.UnusedKeywordOperation, []},
92+
{Check.Warning.UnusedListOperation, []},
93+
{Check.Warning.UnusedPathOperation, []},
94+
{Check.Warning.UnusedRegexOperation, []},
95+
{Check.Warning.UnusedStringOperation, []},
96+
{Check.Warning.UnusedTupleOperation, []},
97+
{Check.Warning.UnsafeExec, []},
98+
99+
## Checks which should always be on for consistency-sake IMO ---------
100+
{Check.Consistency.MultiAliasImportRequireUse, []},
101+
{Check.Consistency.UnusedVariableNames, force: :meaningful},
102+
{Check.Design.DuplicatedCode, []},
103+
{Check.Design.SkipTestWithoutComment, []},
104+
{Check.Readability.ImplTrue, []},
105+
{Check.Readability.MultiAlias, []},
106+
{Check.Readability.NestedFunctionCalls, []},
107+
{Check.Readability.SeparateAliasRequire, []},
108+
{Check.Readability.SingleFunctionToBlockPipe, []},
109+
{Check.Readability.SinglePipe, []},
110+
{Check.Readability.StrictModuleLayout, []},
111+
{Check.Readability.WithCustomTaggedTuple, []},
112+
{Check.Refactor.ABCSize, [max_size: 50]},
113+
{Check.Refactor.AppendSingleItem, []},
114+
{Check.Refactor.DoubleBooleanNegation, []},
115+
{Check.Refactor.FilterReject, []},
116+
{Check.Refactor.MapMap, []},
117+
{Check.Refactor.NegatedIsNil, []},
118+
{Check.Refactor.PipeChainStart, []},
119+
{Check.Refactor.RejectFilter, []},
120+
{Check.Refactor.VariableRebinding, []},
121+
{Check.Warning.LeakyEnvironment, []},
122+
{Check.Warning.MapGetUnsafePass, []},
123+
{Check.Warning.MixEnv, []},
124+
{Check.Warning.UnsafeToAtom, []},
125+
126+
## Causes Issues with Phoenix ----------------------------------------
127+
{Check.Readability.Specs, []},
128+
{Check.Readability.AliasAs, []},
129+
{Check.Refactor.ModuleDependencies, []},
130+
131+
## Optional (move to `disabled` based on app domain) -----------------
132+
{Check.Refactor.IoPuts, []}
133+
],
134+
disabled: [
135+
## Checks which are overly limiting ----------------------------------
136+
{Check.Design.TagTODO, exit_status: 2},
137+
{Check.Design.TagFIXME, []},
138+
{Check.Readability.BlockPipe, []},
139+
140+
## Incompatible with modern versions of Elixir -----------------------
141+
{Check.Refactor.MapInto, []},
142+
{Check.Warning.LazyLogging, []}
143+
]
144+
}
145+
}
146+
]
147+
}

.formatter.exs

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

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
tags
2+
.elixir_ls/
3+
.env
4+
.envrc
5+
_build/
6+
erl_crash.dump
7+
deps/
8+
cover/
9+
apps/**/cover/
10+
priv/plts/

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
elixir 1.13.4
2+
erlang 24.0

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
1-
# sibyl
2-
Compile time and dynamic telemetry library for Elixir
1+
# Sibyl
2+
3+
**TODO: Add description**
4+
5+
## Installation
6+
7+
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
8+
by adding `sibyl` to your list of dependencies in `mix.exs`:
9+
10+
```elixir
11+
def deps do
12+
[
13+
{:sibyl, "~> 0.1.0"}
14+
]
15+
end
16+
```
17+
18+
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
19+
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
20+
be found at <https://hexdocs.pm/sibyl>.
21+

coveralls.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"default_stop_words": [
3+
"defmodule",
4+
"defrecord",
5+
"defimpl",
6+
"defexception",
7+
"defprotocol",
8+
"defstruct",
9+
"def.+(.+\\\\.+).+do",
10+
"^\\s+use\\s+"
11+
],
12+
13+
"custom_stop_words": [
14+
],
15+
16+
"coverage_options": {
17+
"treat_no_relevant_lines_as_covered": true,
18+
"output_dir": "cover/",
19+
"minimum_coverage": 100
20+
},
21+
22+
"terminal_options": {
23+
"file_column_width": 40
24+
}
25+
}

lib/sibyl.ex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
defmodule Sibyl do
2+
@moduledoc """
3+
Documentation for `Sibyl`.
4+
"""
5+
6+
@doc """
7+
Hello world.
8+
9+
## Examples
10+
11+
iex> Sibyl.hello()
12+
:world
13+
14+
"""
15+
@spec hello() :: :world
16+
def hello do
17+
:world
18+
end
19+
end

mix.exs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
defmodule Sibyl.MixProject do
2+
use Mix.Project
3+
4+
def project do
5+
[
6+
app: :sibyl,
7+
version: "0.1.0",
8+
elixir: "~> 1.13",
9+
start_permanent: Mix.env() == :prod,
10+
deps: deps(),
11+
aliases: aliases(),
12+
dialyzer: [
13+
plt_add_apps: [:iex, :mix, :ex_unit],
14+
plt_file: {:no_warn, "priv/plts/dialyzer.plt"},
15+
flags: [:error_handling, :race_conditions]
16+
],
17+
test_coverage: [tool: ExCoveralls],
18+
preferred_cli_env: [
19+
lint: :test,
20+
dialyzer: :test,
21+
coveralls: :test,
22+
"coveralls.detail": :test,
23+
"coveralls.post": :test,
24+
"coveralls.html": :test,
25+
"test.watch": :test
26+
]
27+
]
28+
end
29+
30+
defp deps do
31+
[
32+
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
33+
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
34+
{:ex_doc, "~> 0.28", only: :test},
35+
{:excoveralls, "~> 0.10", only: :test},
36+
{:mix_test_watch, "~> 1.0", only: [:test], runtime: false}
37+
]
38+
end
39+
40+
defp aliases do
41+
[
42+
test: ["coveralls.html --trace --slowest 10"],
43+
lint: [
44+
"format --check-formatted --dry-run",
45+
"credo --strict",
46+
"compile --warnings-as-errors",
47+
"dialyzer"
48+
]
49+
]
50+
end
51+
end

mix.lock

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
%{
2+
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
3+
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
4+
"credo": {:hex, :credo, "1.6.4", "ddd474afb6e8c240313f3a7b0d025cc3213f0d171879429bf8535d7021d9ad78", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "c28f910b61e1ff829bffa056ef7293a8db50e87f2c57a9b5c3f57eee124536b7"},
5+
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
6+
"earmark_parser": {:hex, :earmark_parser, "1.4.26", "f4291134583f373c7d8755566122908eb9662df4c4b63caa66a0eabe06569b0a", [:mix], [], "hexpm", "48d460899f8a0c52c5470676611c01f64f3337bad0b26ddab43648428d94aabc"},
7+
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
8+
"ex_doc": {:hex, :ex_doc, "0.28.4", "001a0ea6beac2f810f1abc3dbf4b123e9593eaa5f00dd13ded024eae7c523298", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bf85d003dd34911d89c8ddb8bda1a958af3471a274a4c2150a9c01c78ac3f8ed"},
9+
"excoveralls": {:hex, :excoveralls, "0.14.5", "5c685449596e962c779adc8f4fb0b4de3a5b291c6121097572a3aa5400c386d3", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e9b4a9bf10e9a6e48b94159e13b4b8a1b05400f17ac16cc363ed8734f26e1f4e"},
10+
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
11+
"hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"},
12+
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
13+
"jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"},
14+
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
15+
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
16+
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
17+
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
18+
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
19+
"mix_test_watch": {:hex, :mix_test_watch, "1.1.0", "330bb91c8ed271fe408c42d07e0773340a7938d8a0d281d57a14243eae9dc8c3", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "52b6b1c476cbb70fd899ca5394506482f12e5f6b0d6acff9df95c7f1e0812ec3"},
20+
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
21+
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
22+
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
23+
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
24+
}

shell.nix

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{ pkgs ? import <nixpkgs> {} }:
2+
3+
with pkgs;
4+
5+
let
6+
elixir = (beam.packagesWith erlangR23).elixir.override {
7+
version = "1.13.4";
8+
sha256 = "1z19hwnv7czmg3p56hdk935gqxig3x7z78yxckh8fs1kdkmslqn4";
9+
};
10+
in
11+
12+
mkShell {
13+
buildInputs = [
14+
elixir
15+
pkgs.inotify-tools
16+
pkgs.docker-compose
17+
];
18+
}

0 commit comments

Comments
 (0)