Update dependencies and make sure everything works with Elixir 1.5

This commit is contained in:
James Harton 2017-09-06 09:41:00 +12:00
parent 77facf65c9
commit 7d7b570325
12 changed files with 49 additions and 32 deletions

View file

@ -10,8 +10,9 @@
configs: [
%{
#
# Run any config using `mix credo -C <name>`. If no config name is given
# 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:
@ -19,24 +20,24 @@
#
# 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: [],
#
# Credo automatically checks for updates, like e.g. Hex does.
# You can disable this behaviour below:
check_for_updates: true,
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
@ -49,7 +50,6 @@
checks: [
{Credo.Check.Consistency.ExceptionNames},
{Credo.Check.Consistency.LineEndings},
{Credo.Check.Consistency.MultiAliasImportRequireUse},
{Credo.Check.Consistency.ParameterPatternMatching},
{Credo.Check.Consistency.SpaceAroundOperators},
{Credo.Check.Consistency.SpaceInParentheses},
@ -57,6 +57,7 @@
# For some checks, like AliasUsage, you can only customize the priority
# Priority values are: `low, normal, high, higher`
#
{Credo.Check.Design.AliasUsage, priority: :low},
# For others you can set parameters
@ -64,11 +65,13 @@
# 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},
@ -78,38 +81,34 @@
{Credo.Check.Readability.ModuleAttributeNames},
{Credo.Check.Readability.ModuleDoc},
{Credo.Check.Readability.ModuleNames},
{Credo.Check.Readability.NoParenthesesWhenZeroArity},
{Credo.Check.Readability.ParenthesesOnZeroArityDefs},
{Credo.Check.Readability.ParenthesesInCondition},
{Credo.Check.Readability.PredicateFunctionNames},
{Credo.Check.Readability.PreferImplicitTry},
{Credo.Check.Readability.RedundantBlankLines},
{Credo.Check.Readability.Specs},
{Credo.Check.Readability.StringSigils},
{Credo.Check.Readability.TrailingBlankLine},
{Credo.Check.Readability.TrailingWhiteSpace},
{Credo.Check.Readability.VariableNames},
{Credo.Check.Refactor.DoubleBooleanNegation},
{Credo.Check.Readability.Semicolons},
{Credo.Check.Readability.SpaceAfterCommas},
# {Credo.Check.Refactor.CaseTrivialMatches}, # deprecated in 0.4.0
{Credo.Check.Refactor.ABCSize},
{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.Refactor.VariableRebinding},
{Credo.Check.Warning.BoolOperationOnSameValues},
{Credo.Check.Warning.IExPry},
{Credo.Check.Warning.IoInspect},
{Credo.Check.Warning.NameRedeclarationByAssignment},
{Credo.Check.Warning.NameRedeclarationByCase},
{Credo.Check.Warning.NameRedeclarationByDef},
{Credo.Check.Warning.NameRedeclarationByFn},
{Credo.Check.Warning.LazyLogging},
{Credo.Check.Warning.OperationOnSameValues},
{Credo.Check.Warning.OperationWithConstantResult},
{Credo.Check.Warning.UnusedEnumOperation},
@ -120,6 +119,23 @@
{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},
{Credo.Check.Refactor.AppendSingleItem, false},
{Credo.Check.Refactor.VariableRebinding},
{Credo.Check.Warning.MapGetUnsafePass},
{Credo.Check.Consistency.MultiAliasImportRequireUse},
# 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`.
#

View file

@ -1,6 +1,7 @@
language: elixir
elixir:
- 1.4.1
- 1.5.1
otp_release:
- 19.2
script:

View file

@ -9,6 +9,6 @@ defimpl Inspect, for: Vivid.Point do
def inspect(point, opts) do
x = point |> Point.x
y = point |> Point.y
concat ["#Vivid.Point<", to_doc({x,y}, opts), ">"]
concat ["#Vivid.Point<", to_doc({x, y}, opts), ">"]
end
end

View file

@ -55,10 +55,10 @@ defmodule Vivid.Font.Char do
coords
|> Enum.reduce([[]], fn
:pen_up, acc -> [[] | acc]
{x,y}, [last | rest] ->
{x, y}, [last | rest] ->
x = round(x_center + (x * scale))
y = round(y_center + (y * scale))
[[Point.init(x,y) | last] | rest]
[[Point.init(x, y) | last] | rest]
end)
|> Enum.map(&Path.init(&1))
|> Group.init

View file

@ -55,7 +55,7 @@ defmodule Vivid.Frame do
#Vivid.Frame<[width: 4, height: 4, background_colour: #Vivid.RGBA<{0, 0, 0, 0}>]>
"""
@spec init(integer(), integer(), Range.t) :: Frame.t
def init(width \\ 128, height \\ 64, %RGBA{} = colour \\ RGBA.init(0,0,0,0))
def init(width \\ 128, height \\ 64, %RGBA{} = colour \\ RGBA.init(0, 0, 0, 0))
when is_integer(width) and is_integer(height) and width > 0 and height > 0
do
%Frame{width: width, height: height, background_colour: colour, shapes: []}

View file

@ -50,7 +50,7 @@ defmodule Vivid.Hershey do
defp parse_coords(parsed, ""), do: parsed |> Enum.reverse
defp parse_coords(parsed, " R" <> rest), do: parse_coords([:pen_up | parsed], rest)
defp parse_coords(parsed, << xy::binary-size(2), rest::binary >>) do
[y,x] = xy |> String.to_charlist
[y, x] = xy |> String.to_charlist
normalized_x = @mid_point - x
normalized_y = y - @mid_point
parse_coords([{normalized_y, normalized_x} | parsed], rest)

View file

@ -41,8 +41,8 @@ defmodule Vivid.Line do
Create a `Line` from a two-element list of points.
"""
@spec init([Point.t]) :: Line.t
def init([o,t]) do
init(o,t)
def init([o, t]) do
init(o, t)
end
@doc ~S"""

View file

@ -23,7 +23,7 @@ defmodule Vivid.Math do
@doc """
Delegates to `:math.pow/2`.
"""
defdelegate pow(x,y), to: :math
defdelegate pow(x, y), to: :math
@doc """
Delegates to `:math.sqrt/1`.

View file

@ -62,7 +62,7 @@ defimpl Vivid.Rasterize, for: Vivid.Line do
points
|> Stream.map(&Point.round(&1))
|> Stream.filter(&Bounds.contains?(bounds,&1))
|> Stream.filter(&Bounds.contains?(bounds, &1))
|> Enum.into(MapSet.new)
end

View file

@ -124,7 +124,7 @@ defmodule Vivid.RGBA do
#Vivid.RGBA<{1, 1, 1, 1}>
"""
@spec white() :: RGBA.t
def white, do: RGBA.init(1,1,1)
def white, do: RGBA.init(1, 1, 1)
@doc """
Shorthand for black.
@ -135,7 +135,7 @@ defmodule Vivid.RGBA do
#Vivid.RGBA<{0, 0, 0, 1}>
"""
@spec black() :: RGBA.t
def black, do: RGBA.init(0,0,0)
def black, do: RGBA.init(0, 0, 0)
@doc """
Return the red component of the colour.

View file

@ -23,7 +23,7 @@ defmodule Vivid.Transform.Point do
Scale `point` (ie move it) by multiplying it's distance from the `0`, `0` point by `x_factor` and `y_factor`.
"""
@spec scale(Point, number, number) :: Point.t
def scale(%Point{} = point, x_factor, y_factor), do: scale(point, x_factor, y_factor, Point.init(0,0))
def scale(%Point{} = point, x_factor, y_factor), do: scale(point, x_factor, y_factor, Point.init(0, 0))
@doc """
Scale `point` (ie move it) by multiplying it's distance from the origin point by `x_factor` and `y_factor`.
@ -48,6 +48,6 @@ defmodule Vivid.Transform.Point do
def rotate_radians(%Point{x: x0, y: y0} = _point, %Point{x: x1, y: y1} = _origin, radians) do
x = cos(radians) * (x0 - x1) - sin(radians) * (y0 - y1) + x1
y = sin(radians) * (x0 - x1) + cos(radians) * (y0 - y1) + y1
Point.init(x,y)
Point.init(x, y)
end
end

View file

@ -1,6 +1,6 @@
%{"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], []},
"credo": {:hex, :credo, "0.6.1", "a941e2591bd2bd2055dc92b810c174650b40b8290459c89a835af9d59ac4a5f8", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, optional: false]}]},
"earmark": {:hex, :earmark, "1.0.3", "89bdbaf2aca8bbb5c97d8b3b55c5dd0cff517ecc78d417e87f1d0982e514557b", [:mix], []},
"ex_doc": {:hex, :ex_doc, "0.14.5", "c0433c8117e948404d93ca69411dd575ec6be39b47802e81ca8d91017a0cf83c", [:mix], [{:earmark, "~> 1.0", [hex: :earmark, optional: false]}]},
"credo": {:hex, :credo, "0.8.6", "335f723772d35da499b5ebfdaf6b426bfb73590b6fcbc8908d476b75f8cbca3f", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, optional: false]}]},
"earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], []},
"ex_doc": {:hex, :ex_doc, "0.16.3", "cd2a4cfe5d26e37502d3ec776702c72efa1adfa24ed9ce723bb565f4c30bd31a", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, optional: false]}]},
"inch_ex": {:hex, :inch_ex, "0.5.6", "418357418a553baa6d04eccd1b44171936817db61f4c0840112b420b8e378e67", [:mix], [{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, optional: false]}]},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []}}