Skip to content

Commit ed1e00a

Browse files
authored
Merge pull request #7 from keathley/update-ci
Update CI
2 parents 960ad89 + da7ec33 commit ed1e00a

File tree

4 files changed

+252
-8
lines changed

4 files changed

+252
-8
lines changed

.credo.exs

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
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 exec using `mix credo -C <name>`. If no exec 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: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
26+
},
27+
#
28+
# Load and configure plugins here:
29+
#
30+
plugins: [],
31+
#
32+
# If you create your own checks, you must specify the source files for
33+
# them here, so they can be loaded by Credo before running the analysis.
34+
#
35+
requires: [],
36+
#
37+
# If you want to enforce a style guide and need a more traditional linting
38+
# experience, you can change `strict` to `true` below:
39+
#
40+
strict: false,
41+
#
42+
# If you want to use uncolored output by default, you can change `color`
43+
# to `false` below:
44+
#
45+
color: true,
46+
#
47+
# You can customize the parameters of any check by adding a second element
48+
# to the tuple.
49+
#
50+
# To disable a check put `false` as second element:
51+
#
52+
# {Credo.Check.Design.DuplicatedCode, false}
53+
#
54+
checks: [
55+
#
56+
## Consistency Checks
57+
#
58+
{Credo.Check.Consistency.ExceptionNames, []},
59+
{Credo.Check.Consistency.LineEndings, []},
60+
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
61+
{Credo.Check.Consistency.ParameterPatternMatching, []},
62+
{Credo.Check.Consistency.SpaceAroundOperators, false},
63+
{Credo.Check.Consistency.SpaceInParentheses, false},
64+
{Credo.Check.Consistency.TabsOrSpaces, []},
65+
{Credo.Check.Consistency.UnusedVariableNames, false},
66+
67+
#
68+
## Design Checks
69+
#
70+
# You can customize the priority of any check
71+
# Priority values are: `low, normal, high, higher`
72+
#
73+
{Credo.Check.Design.AliasUsage,
74+
[priority: :low, if_nested_deeper_than: 4, if_called_more_often_than: 2]},
75+
{Credo.Check.Design.DuplicatedCode, false},
76+
{Credo.Check.Design.TagTODO, false},
77+
{Credo.Check.Design.TagFIXME, false},
78+
79+
#
80+
## Readability Checks
81+
#
82+
{Credo.Check.Readability.AliasAs, false},
83+
{Credo.Check.Readability.AliasOrder, false},
84+
{Credo.Check.Readability.FunctionNames, []},
85+
{Credo.Check.Readability.LargeNumbers, []},
86+
{Credo.Check.Readability.MaxLineLength, false},
87+
{Credo.Check.Readability.ModuleAttributeNames, []},
88+
{Credo.Check.Readability.ModuleDoc, []},
89+
{Credo.Check.Readability.ModuleNames, []},
90+
{Credo.Check.Readability.MultiAlias, false},
91+
{Credo.Check.Readability.ParenthesesInCondition, []},
92+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
93+
{Credo.Check.Readability.PredicateFunctionNames, false},
94+
{Credo.Check.Readability.PreferImplicitTry, []},
95+
{Credo.Check.Readability.RedundantBlankLines, [max_blank_lines: 1]},
96+
{Credo.Check.Readability.Semicolons, []},
97+
{Credo.Check.Readability.SinglePipe, false},
98+
{Credo.Check.Readability.SpaceAfterCommas, false},
99+
{Credo.Check.Readability.Specs, false},
100+
{Credo.Check.Readability.StringSigils, []},
101+
{Credo.Check.Readability.TrailingBlankLine, []},
102+
{Credo.Check.Readability.TrailingWhiteSpace, []},
103+
# TODO: enable by default in Credo 1.1
104+
{Credo.Check.Readability.UnnecessaryAliasExpansion, false},
105+
{Credo.Check.Readability.VariableNames, []},
106+
107+
#
108+
# Controversial and experimental checks (opt-in, just replace `false` with `[]`)
109+
#
110+
111+
#
112+
## Refactoring Opportunities
113+
#
114+
{Credo.Check.Refactor.ABCSize, false},
115+
{Credo.Check.Refactor.AppendSingleItem, false},
116+
{Credo.Check.Refactor.CaseTrivialMatches, false},
117+
{Credo.Check.Refactor.CondStatements, false},
118+
{Credo.Check.Refactor.CyclomaticComplexity, [max_complexity: 18]},
119+
{Credo.Check.Refactor.DoubleBooleanNegation, false},
120+
{Credo.Check.Refactor.FunctionArity, []},
121+
{Credo.Check.Refactor.LongQuoteBlocks, false},
122+
{Credo.Check.Refactor.MapInto, false},
123+
{Credo.Check.Refactor.MatchInCondition, false},
124+
{Credo.Check.Refactor.ModuleDependencies, false},
125+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
126+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
127+
{Credo.Check.Refactor.Nesting, false},
128+
{Credo.Check.Refactor.PipeChainStart, false},
129+
{Credo.Check.Refactor.UnlessWithElse, []},
130+
{Credo.Check.Refactor.VariableRebinding, false},
131+
{Credo.Check.Refactor.WithClauses, []},
132+
133+
#
134+
## Warnings
135+
#
136+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
137+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
138+
{Credo.Check.Warning.IExPry, []},
139+
{Credo.Check.Warning.IoInspect, []},
140+
{Credo.Check.Warning.LazyLogging, false},
141+
{Credo.Check.Warning.MapGetUnsafePass, false},
142+
{Credo.Check.Warning.OperationOnSameValues, []},
143+
{Credo.Check.Warning.OperationWithConstantResult, false},
144+
{Credo.Check.Warning.RaiseInsideRescue, []},
145+
{Credo.Check.Warning.UnsafeToAtom, false},
146+
{Credo.Check.Warning.UnusedEnumOperation, []},
147+
{Credo.Check.Warning.UnusedFileOperation, []},
148+
{Credo.Check.Warning.UnusedKeywordOperation, []},
149+
{Credo.Check.Warning.UnusedListOperation, []},
150+
{Credo.Check.Warning.UnusedPathOperation, []},
151+
{Credo.Check.Warning.UnusedRegexOperation, []},
152+
{Credo.Check.Warning.UnusedStringOperation, []},
153+
{Credo.Check.Warning.UnusedTupleOperation, []},
154+
]
155+
}
156+
]
157+
}

.github/workflows/elixir.yml

Lines changed: 89 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,101 @@ on:
66
pull_request:
77
branches: [ master ]
88

9-
jobs:
10-
build:
9+
env:
10+
MIX_ENV: test
1111

12+
jobs:
13+
deps:
14+
name: Install Dependencies
1215
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
elixir: [1.11]
19+
otp: [23.3]
20+
steps:
21+
- name: checkout
22+
uses: actions/checkout@v2
23+
with:
24+
fetch-depth: 0
25+
- name: setup
26+
uses: erlef/setup-beam@v1
27+
with:
28+
elixir-version: ${{ matrix.elixir }}
29+
otp-version: ${{ matrix.otp }}
30+
- name: Retrieve Cached Dependencies
31+
uses: actions/cache@v2
32+
id: mix-cache
33+
with:
34+
path: |
35+
deps
36+
_build
37+
priv/plts
38+
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
39+
- name: Install deps
40+
if: steps.mix-cache.outputs.cache-hit != 'true'
41+
run: |
42+
mkdir -p priv/plts
43+
mix local.rebar --force
44+
mix local.hex --force
45+
mix deps.get
46+
mix deps.compile
47+
mix dialyzer --plt
1348
49+
analyze:
50+
name: Analysis
51+
needs: deps
52+
runs-on: ubuntu-latest
53+
strategy:
54+
matrix:
55+
elixir: [1.11]
56+
otp: [23.3]
1457
steps:
1558
- uses: actions/checkout@v2
59+
with:
60+
fetch-depth: 0
1661
- name: Setup elixir
17-
uses: actions/setup-elixir@v1
62+
uses: erlef/setup-beam@v1
63+
with:
64+
elixir-version: ${{ matrix.elixir }}
65+
otp-version: ${{ matrix.otp }}
66+
- name: Retrieve Cached Dependencies
67+
uses: actions/cache@v2
68+
id: mix-cache
69+
with:
70+
path: |
71+
deps
72+
_build
73+
priv/plts
74+
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
75+
- name: Run Credo
76+
run: mix credo
77+
- name: Run Dialyzer
78+
run: mix dialyzer --no-check --halt-exit-status
79+
80+
tests:
81+
name: Tests
82+
needs: deps
83+
runs-on: ubuntu-latest
84+
strategy:
85+
matrix:
86+
elixir: [1.11]
87+
otp: [23.3]
88+
steps:
89+
- uses: actions/checkout@v2
90+
with:
91+
fetch-depth: 0
92+
- uses: erlef/setup-beam@v1
93+
with:
94+
elixir-version: ${{ matrix.elixir }}
95+
otp-version: ${{ matrix.otp }}
96+
- name: Retrieve Cached Dependencies
97+
uses: actions/cache@v2
98+
id: mix-cache
1899
with:
19-
elixir-version: 1.9.4 # Define the elixir version [required]
20-
otp-version: 22.2 # Define the OTP version [required]
21-
- name: Install Dependencies
22-
run: mix deps.get
100+
path: |
101+
deps
102+
_build
103+
priv/plts
104+
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
23105
- name: Run Tests
24106
run: mix test

mix.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ defmodule CircularBuffer.MixProject do
2828
defp deps do
2929
[
3030
{:propcheck, "~> 1.2", only: [:dev, :test]},
31+
{:credo, "~> 1.5", only: [:dev, :test]},
3132
{:ex_doc, "~> 0.19", only: [:dev, :test], runtime: false},
32-
{:dialyxir, "~> 1.1.0", only: :dev, runtime: false}
33+
{:dialyxir, "~> 1.1.0", only: [:dev, :test], runtime: false}
3334
]
3435
end
3536

mix.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
%{
2+
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
3+
"credo": {:hex, :credo, "1.5.5", "e8f422026f553bc3bebb81c8e8bf1932f498ca03339856c7fec63d3faac8424b", [: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", "dd8623ab7091956a855dc9f3062486add9c52d310dfd62748779c4315d8247de"},
24
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
35
"earmark_parser": {:hex, :earmark_parser, "1.4.13", "0c98163e7d04a15feb62000e1a891489feb29f3d10cb57d4f845c405852bbef8", [:mix], [], "hexpm", "d602c26af3a0af43d2f2645613f65841657ad6efc9f0e361c3b6c06b578214ba"},
46
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
57
"ex_doc": {:hex, :ex_doc, "0.24.2", "e4c26603830c1a2286dae45f4412a4d1980e1e89dc779fcd0181ed1d5a05c8d9", [:mix], [{:earmark_parser, "~> 1.4.0", [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", "e134e1d9e821b8d9e4244687fb2ace58d479b67b282de5158333b0d57c6fb7da"},
8+
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
9+
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
610
"libgraph": {:hex, :libgraph, "0.13.3", "20732b7bafb933dcf7351c479e03076ebd14a85fd3202c67a1c197f4f7c2466b", [:mix], [], "hexpm", "78f2576eef615440b46f10060b1de1c86640441422832052686df53dc3c148c6"},
711
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
812
"makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"},

0 commit comments

Comments
 (0)