Update dependencies and CI config.
This commit is contained in:
parent
95daf32624
commit
2fea5c1b1e
9 changed files with 68 additions and 155 deletions
146
.credo.exs
146
.credo.exs
|
@ -1,146 +0,0 @@
|
||||||
# This file contains the configuration for Credo and you are probably reading
|
|
||||||
# this after creating it with `mix credo.gen.config`.
|
|
||||||
#
|
|
||||||
# If you find anything wrong or unclear in this file, please report an
|
|
||||||
# issue on GitHub: https://github.com/rrrene/credo/issues
|
|
||||||
#
|
|
||||||
%{
|
|
||||||
#
|
|
||||||
# You can have as many configs as you like in the `configs:` field.
|
|
||||||
configs: [
|
|
||||||
%{
|
|
||||||
#
|
|
||||||
# Run any exec using `mix credo -C <name>`. If no exec name is given
|
|
||||||
# "default" is used.
|
|
||||||
#
|
|
||||||
name: "default",
|
|
||||||
#
|
|
||||||
# These are the files included in the analysis:
|
|
||||||
files: %{
|
|
||||||
#
|
|
||||||
# You can give explicit globs or simply directories.
|
|
||||||
# In the latter case `**/*.{ex,exs}` will be used.
|
|
||||||
#
|
|
||||||
included: ["lib/", "src/", "web/", "apps/"],
|
|
||||||
excluded: [~r"/_build/", ~r"/deps/"]
|
|
||||||
},
|
|
||||||
#
|
|
||||||
# If you create your own checks, you must specify the source files for
|
|
||||||
# them here, so they can be loaded by Credo before running the analysis.
|
|
||||||
#
|
|
||||||
requires: [],
|
|
||||||
#
|
|
||||||
# If you want to enforce a style guide and need a more traditional linting
|
|
||||||
# experience, you can change `strict` to `true` below:
|
|
||||||
#
|
|
||||||
strict: false,
|
|
||||||
#
|
|
||||||
# If you want to use uncolored output by default, you can change `color`
|
|
||||||
# to `false` below:
|
|
||||||
#
|
|
||||||
color: true,
|
|
||||||
#
|
|
||||||
# You can customize the parameters of any check by adding a second element
|
|
||||||
# to the tuple.
|
|
||||||
#
|
|
||||||
# To disable a check put `false` as second element:
|
|
||||||
#
|
|
||||||
# {Credo.Check.Design.DuplicatedCode, false}
|
|
||||||
#
|
|
||||||
checks: [
|
|
||||||
{Credo.Check.Consistency.ExceptionNames},
|
|
||||||
{Credo.Check.Consistency.LineEndings},
|
|
||||||
{Credo.Check.Consistency.ParameterPatternMatching},
|
|
||||||
{Credo.Check.Consistency.SpaceAroundOperators},
|
|
||||||
{Credo.Check.Consistency.SpaceInParentheses},
|
|
||||||
{Credo.Check.Consistency.TabsOrSpaces},
|
|
||||||
|
|
||||||
# You can customize the priority of any check
|
|
||||||
# Priority values are: `low, normal, high, higher`
|
|
||||||
#
|
|
||||||
{Credo.Check.Design.AliasUsage, priority: :low},
|
|
||||||
|
|
||||||
# For some checks, you can also set other parameters
|
|
||||||
#
|
|
||||||
# If you don't want the `setup` and `test` macro calls in ExUnit tests
|
|
||||||
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
|
|
||||||
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
|
|
||||||
#
|
|
||||||
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
|
|
||||||
|
|
||||||
# You can also customize the exit_status of each check.
|
|
||||||
# If you don't want TODO comments to cause `mix credo` to fail, just
|
|
||||||
# set this value to 0 (zero).
|
|
||||||
#
|
|
||||||
{Credo.Check.Design.TagTODO, exit_status: 2},
|
|
||||||
{Credo.Check.Design.TagFIXME},
|
|
||||||
|
|
||||||
{Credo.Check.Readability.FunctionNames},
|
|
||||||
{Credo.Check.Readability.LargeNumbers},
|
|
||||||
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 120},
|
|
||||||
{Credo.Check.Readability.ModuleAttributeNames},
|
|
||||||
{Credo.Check.Readability.ModuleDoc},
|
|
||||||
{Credo.Check.Readability.ModuleNames},
|
|
||||||
{Credo.Check.Readability.ParenthesesOnZeroArityDefs},
|
|
||||||
{Credo.Check.Readability.ParenthesesInCondition},
|
|
||||||
{Credo.Check.Readability.PredicateFunctionNames},
|
|
||||||
{Credo.Check.Readability.PreferImplicitTry},
|
|
||||||
{Credo.Check.Readability.RedundantBlankLines},
|
|
||||||
{Credo.Check.Readability.StringSigils},
|
|
||||||
{Credo.Check.Readability.TrailingBlankLine},
|
|
||||||
{Credo.Check.Readability.TrailingWhiteSpace},
|
|
||||||
{Credo.Check.Readability.VariableNames},
|
|
||||||
{Credo.Check.Readability.Semicolons},
|
|
||||||
{Credo.Check.Readability.SpaceAfterCommas},
|
|
||||||
|
|
||||||
{Credo.Check.Refactor.DoubleBooleanNegation},
|
|
||||||
{Credo.Check.Refactor.CondStatements},
|
|
||||||
{Credo.Check.Refactor.CyclomaticComplexity},
|
|
||||||
{Credo.Check.Refactor.FunctionArity},
|
|
||||||
{Credo.Check.Refactor.LongQuoteBlocks},
|
|
||||||
{Credo.Check.Refactor.MatchInCondition},
|
|
||||||
{Credo.Check.Refactor.NegatedConditionsInUnless},
|
|
||||||
{Credo.Check.Refactor.NegatedConditionsWithElse},
|
|
||||||
{Credo.Check.Refactor.Nesting},
|
|
||||||
{Credo.Check.Refactor.PipeChainStart},
|
|
||||||
{Credo.Check.Refactor.UnlessWithElse},
|
|
||||||
|
|
||||||
{Credo.Check.Warning.BoolOperationOnSameValues},
|
|
||||||
{Credo.Check.Warning.ExpensiveEmptyEnumCheck},
|
|
||||||
{Credo.Check.Warning.IExPry},
|
|
||||||
{Credo.Check.Warning.IoInspect},
|
|
||||||
{Credo.Check.Warning.LazyLogging},
|
|
||||||
{Credo.Check.Warning.OperationOnSameValues},
|
|
||||||
{Credo.Check.Warning.OperationWithConstantResult},
|
|
||||||
{Credo.Check.Warning.UnusedEnumOperation},
|
|
||||||
{Credo.Check.Warning.UnusedFileOperation},
|
|
||||||
{Credo.Check.Warning.UnusedKeywordOperation},
|
|
||||||
{Credo.Check.Warning.UnusedListOperation},
|
|
||||||
{Credo.Check.Warning.UnusedPathOperation},
|
|
||||||
{Credo.Check.Warning.UnusedRegexOperation},
|
|
||||||
{Credo.Check.Warning.UnusedStringOperation},
|
|
||||||
{Credo.Check.Warning.UnusedTupleOperation},
|
|
||||||
{Credo.Check.Warning.RaiseInsideRescue},
|
|
||||||
|
|
||||||
# Controversial and experimental checks (opt-in, just remove `, false`)
|
|
||||||
#
|
|
||||||
{Credo.Check.Refactor.ABCSize, false},
|
|
||||||
{Credo.Check.Refactor.AppendSingleItem, false},
|
|
||||||
{Credo.Check.Refactor.VariableRebinding, false},
|
|
||||||
{Credo.Check.Warning.MapGetUnsafePass, false},
|
|
||||||
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
|
|
||||||
|
|
||||||
# Deprecated checks (these will be deleted after a grace period)
|
|
||||||
#
|
|
||||||
{Credo.Check.Readability.Specs, false},
|
|
||||||
{Credo.Check.Warning.NameRedeclarationByAssignment, false},
|
|
||||||
{Credo.Check.Warning.NameRedeclarationByCase, false},
|
|
||||||
{Credo.Check.Warning.NameRedeclarationByDef, false},
|
|
||||||
{Credo.Check.Warning.NameRedeclarationByFn, false},
|
|
||||||
|
|
||||||
# Custom checks can be created using `mix credo.gen.check`.
|
|
||||||
#
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
3
.formatter.exs
Normal file
3
.formatter.exs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[
|
||||||
|
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"]
|
||||||
|
]
|
37
.gitlab-ci.yml
Normal file
37
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
image: elixir:latest
|
||||||
|
|
||||||
|
cache:
|
||||||
|
key: "$CI_JOB_NAME"
|
||||||
|
paths:
|
||||||
|
- deps
|
||||||
|
- _build
|
||||||
|
- /root/.mix
|
||||||
|
|
||||||
|
variables:
|
||||||
|
MIX_ENV: "test"
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- mix local.hex --force
|
||||||
|
- mix local.rebar --force
|
||||||
|
- mix deps.get --only test
|
||||||
|
|
||||||
|
test:
|
||||||
|
script:
|
||||||
|
- mix test
|
||||||
|
|
||||||
|
credo:
|
||||||
|
script:
|
||||||
|
- mix credo --strict
|
||||||
|
|
||||||
|
audit:
|
||||||
|
script:
|
||||||
|
- mix hex.audit
|
||||||
|
|
||||||
|
format:
|
||||||
|
script:
|
||||||
|
- mix format --check-formatted
|
||||||
|
|
||||||
|
# inch:
|
||||||
|
# script:
|
||||||
|
# - mix inch --pedantic
|
||||||
|
|
|
@ -42,7 +42,7 @@ defmodule Heap do
|
||||||
def max, do: Heap.new(:>)
|
def max, do: Heap.new(:>)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Create an empty `Heap` with the default comparator (`>`).
|
Create an empty `Heap` with the default comparator (`<`).
|
||||||
|
|
||||||
Defaults to `>`.
|
Defaults to `>`.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
defimpl Collectable, for: Heap do
|
defimpl Collectable, for: Heap do
|
||||||
|
@moduledoc """
|
||||||
|
Implements `Collectable` for `Heap`.
|
||||||
|
"""
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Collect an enumerable into a heap.
|
Collect an enumerable into a heap.
|
||||||
|
|
||||||
|
|
|
@ -60,4 +60,11 @@ defimpl Enumerable, for: Heap do
|
||||||
reduce(heap, fun.(root, acc), fun)
|
reduce(heap, fun.(root, acc), fun)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
There's no fast way to slice a Heap so we return `{:error, __MODULE__}` to
|
||||||
|
allow Elixir to use the default algorithm.
|
||||||
|
"""
|
||||||
|
@spec slice(Heap.t()) :: {:error, __MODULE__}
|
||||||
|
def slice(_heap), do: {:error, __MODULE__}
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
defimpl Inspect, for: Heap do
|
defimpl Inspect, for: Heap do
|
||||||
import Inspect.Algebra
|
import Inspect.Algebra
|
||||||
|
|
||||||
|
@moduledoc """
|
||||||
|
Implements `Inspect` for `Heap`.
|
||||||
|
"""
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Format the heap nicely for inspection.
|
Format the heap nicely for inspection.
|
||||||
|
|
||||||
|
|
8
mix.exs
8
mix.exs
|
@ -4,7 +4,7 @@ defmodule Heap.Mixfile do
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :heap,
|
app: :heap,
|
||||||
version: "2.0.0",
|
version: "2.0.1",
|
||||||
description: description(),
|
description: description(),
|
||||||
elixir: "~> 1.5",
|
elixir: "~> 1.5",
|
||||||
build_embedded: Mix.env() == :prod,
|
build_embedded: Mix.env() == :prod,
|
||||||
|
@ -30,7 +30,7 @@ defmodule Heap.Mixfile do
|
||||||
maintainers: ["James Harton <james@automat.nz>"],
|
maintainers: ["James Harton <james@automat.nz>"],
|
||||||
licenses: ["MIT"],
|
licenses: ["MIT"],
|
||||||
links: %{
|
links: %{
|
||||||
"GitHub" => "https://github.com/jamesotron/heap",
|
"Repository" => "https://gitlab.com/jimsy/heap",
|
||||||
"Docs" => "https://hexdocs.pm/heap"
|
"Docs" => "https://hexdocs.pm/heap"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -49,8 +49,8 @@ defmodule Heap.Mixfile do
|
||||||
[
|
[
|
||||||
{:ex_doc, ">= 0.0.0", only: :dev},
|
{:ex_doc, ">= 0.0.0", only: :dev},
|
||||||
{:earmark, ">= 0.0.0", only: :dev},
|
{:earmark, ">= 0.0.0", only: :dev},
|
||||||
{:credo, "~> 0.6", only: ~w(dev test)a, runtime: false},
|
{:credo, "~> 0.10", only: ~w(dev test)a, runtime: false},
|
||||||
{:inch_ex, "~> 0.5", only: ~w(dev test)a, runtime: false}
|
{:inch_ex, "~> 1.0", only: ~w(dev test)a, runtime: false}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
12
mix.lock
12
mix.lock
|
@ -1,10 +1,14 @@
|
||||||
%{
|
%{
|
||||||
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
|
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"},
|
||||||
"credo": {:hex, :credo, "0.8.10", "261862bb7363247762e1063713bb85df2bbd84af8d8610d1272cd9c1943bba63", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}], "hexpm"},
|
"credo": {:hex, :credo, "0.10.0", "66234a95effaf9067edb19fc5d0cd5c6b461ad841baac42467afed96c78e5e9e", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"},
|
||||||
"earmark": {:hex, :earmark, "1.2.4", "99b637c62a4d65a20a9fb674b8cffb8baa771c04605a80c911c4418c69b75439", [:mix], [], "hexpm"},
|
"earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "hexpm"},
|
||||||
"espec": {:hex, :espec, "0.8.28", "f002710673d215876c4ca6fc74cbf5e330954badea7389d2284d2050940f1779", [:mix], [{:meck, "~> 0.8.4", [hex: :meck, optional: false]}]},
|
"espec": {:hex, :espec, "0.8.28", "f002710673d215876c4ca6fc74cbf5e330954badea7389d2284d2050940f1779", [:mix], [{:meck, "~> 0.8.4", [hex: :meck, optional: false]}]},
|
||||||
"ex_doc": {:hex, :ex_doc, "0.18.2", "993e0a95e9fbb790ac54ea58e700b45b299bd48bc44b4ae0404f28161f37a83e", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
|
"ex_doc": {:hex, :ex_doc, "0.19.1", "519bb9c19526ca51d326c060cb1778d4a9056b190086a8c6c115828eaccea6cf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.7", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
|
||||||
"inch_ex": {:hex, :inch_ex, "0.5.6", "418357418a553baa6d04eccd1b44171936817db61f4c0840112b420b8e378e67", [:mix], [{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
|
"inch_ex": {:hex, :inch_ex, "1.0.0", "18496a900ca4b7542a1ff1159e7f8be6c2012b74ca55ac70de5e805f14cdf939", [:mix], [{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
|
||||||
|
"jason": {:hex, :jason, "1.1.1", "d3ccb840dfb06f2f90a6d335b536dd074db748b3e7f5b11ab61d239506585eb2", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
|
||||||
|
"makeup": {:hex, :makeup, "0.5.1", "966c5c2296da272d42f1de178c1d135e432662eca795d6dc12e5e8787514edf7", [:mix], [{:nimble_parsec, "~> 0.2.2", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
|
||||||
|
"makeup_elixir": {:hex, :makeup_elixir, "0.8.0", "1204a2f5b4f181775a0e456154830524cf2207cf4f9112215c05e0b76e4eca8b", [:mix], [{:makeup, "~> 0.5.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 0.2.2", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"},
|
||||||
"meck": {:hex, :meck, "0.8.8", "eeb3efe811d4346e1a7f65b2738abc2ad73cbe1a2c91b5dd909bac2ea0414fa6", [:rebar3], []},
|
"meck": {:hex, :meck, "0.8.8", "eeb3efe811d4346e1a7f65b2738abc2ad73cbe1a2c91b5dd909bac2ea0414fa6", [:rebar3], []},
|
||||||
|
"nimble_parsec": {:hex, :nimble_parsec, "0.2.2", "d526b23bdceb04c7ad15b33c57c4526bf5f50aaa70c7c141b4b4624555c68259", [:mix], [], "hexpm"},
|
||||||
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
|
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue