Update CI config and dependencies.

This commit is contained in:
James Harton 2018-09-04 03:10:02 +00:00
parent 7f271e7572
commit abeab179b5
9 changed files with 46 additions and 17 deletions

3
.formatter.exs Normal file
View file

@ -0,0 +1,3 @@
[
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

View file

@ -1,4 +1,11 @@
image: elixir:1.5
image: elixir:latest
cache:
key: "$CI_JOB_NAME"
paths:
- deps
- _build
- /root/.mix
variables:
MIX_ENV: "test"
@ -11,8 +18,20 @@ before_script:
test:
script:
- mix test
- mix credo --strict
- mix inch --pedantic
after_script:
- mix inch.report
credo:
script:
- mix credo --strict
audit:
script:
- mix hex.audit
format:
script:
- mix format --check-formatted
# inch:
# script:
# - mix inch --pedantic

View file

@ -1,6 +1,6 @@
defmodule Angle do
defstruct ~w(d r g dms)a
alias Angle.{Radian, Gradian, Degree, DMS, Trig}
alias Angle.{Degree, DMS, Gradian, Radian, Trig}
@moduledoc """
Tired of forever converting back and forwards between degrees and radians?

View file

@ -94,7 +94,8 @@ defmodule Angle.Degree do
%{angle | d: degrees}
end
def ensure(%Angle{dms: {d, m, s}} = angle) when is_integer(d) and is_integer(m) and is_number(s) do
def ensure(%Angle{dms: {d, m, s}} = angle)
when is_integer(d) and is_integer(m) and is_number(s) do
%{angle | d: d + m / 60.0 + s / 3600.0}
end

View file

@ -96,7 +96,8 @@ defmodule Angle.Radian do
%{angle | r: radians}
end
def ensure(%Angle{dms: {d, m, s}} = angle) when is_integer(d) and is_integer(m) and is_number(s) do
def ensure(%Angle{dms: {d, m, s}} = angle)
when is_integer(d) and is_integer(m) and is_number(s) do
degrees = d + m / 60.0 + s / 3600.0
radians = degrees / 180.0 * :math.pi()
%{angle | r: radians}

View file

@ -1,6 +1,6 @@
defmodule Angle.Sigil do
alias Angle
alias Angle.{InvalidAngle, Radian, Degree, Gradian, DMS}
alias Angle.{Degree, DMS, Gradian, InvalidAngle, Radian}
@moduledoc """
This module defines the `~a` macros. To use it just `use Angle`.

View file

@ -34,7 +34,8 @@ defimpl Inspect, for: Angle do
concat(["#Angle<", to_doc(d, opts), @degrees, " ", to_doc(m, opts), @prime, ">"])
end
def inspect(%Angle{dms: {d, m, s}}, opts) when is_integer(d) and is_integer(m) and is_number(s) do
def inspect(%Angle{dms: {d, m, s}}, opts)
when is_integer(d) and is_integer(m) and is_number(s) do
concat([
"#Angle<",
to_doc(d, opts),

View file

@ -5,7 +5,7 @@ defmodule Angle.Mixfile do
Tired of forever converting back and forwards between degrees and radians?
Well worry no more; Angle is here to make your life simple!
"""
@version "0.2.1"
@version "0.3.0"
def project do
[
@ -41,8 +41,8 @@ defmodule Angle.Mixfile do
[
{:ex_doc, ">= 0.0.0", only: :dev},
{:earmark, ">= 0.0.0", only: :dev},
{:credo, "~> 0.6", only: ~w(dev test)a, runtime: false},
{:inch_ex, "~> 0.5", only: ~w(dev test)a, runtime: false},
{:credo, "~> 0.10", only: ~w(dev test)a, runtime: false},
{:inch_ex, "~> 1.0", only: ~w(dev test)a, runtime: false},
{:dialyxir, "~> 0.5", only: ~w(dev test)a, runtime: false}
]
end

View file

@ -1,9 +1,13 @@
%{
"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"},
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"},
"earmark": {:hex, :earmark, "1.2.4", "99b637c62a4d65a20a9fb674b8cffb8baa771c04605a80c911c4418c69b75439", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.18.1", "37c69d2ef62f24928c1f4fdc7c724ea04aecfdf500c4329185f8e3649c915baf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, 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"},
"earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "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, "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"},
"nimble_parsec": {:hex, :nimble_parsec, "0.2.2", "d526b23bdceb04c7ad15b33c57c4526bf5f50aaa70c7c141b4b4624555c68259", [:mix], [], "hexpm"},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
}