diff --git a/.hound.yml b/.hound.yml new file mode 100644 index 0000000..f283ada --- /dev/null +++ b/.hound.yml @@ -0,0 +1,2 @@ +credo: + enabled: true diff --git a/lib/chess.ex b/lib/chess.ex index 75097e7..923ec2f 100644 --- a/lib/chess.ex +++ b/lib/chess.ex @@ -1,4 +1,6 @@ defmodule Chess do + @moduledoc false + use Application # See http://elixir-lang.org/docs/stable/elixir/Application.html diff --git a/lib/chess/auth.ex b/lib/chess/auth.ex index 44a0c39..4b22712 100644 --- a/lib/chess/auth.ex +++ b/lib/chess/auth.ex @@ -105,10 +105,11 @@ defmodule Chess.Auth do @doc false def authenticate_user(username, password) do - Repo.one( - from u in User, - where: u.username == ^username - ) + query = from u in User, + where: u.username == ^username + + query + |> Repo.one |> Argon2.check_pass(password) end end diff --git a/lib/chess/auth/guardian.ex b/lib/chess/auth/guardian.ex index 7af60b8..5b4fef9 100644 --- a/lib/chess/auth/guardian.ex +++ b/lib/chess/auth/guardian.ex @@ -1,4 +1,6 @@ defmodule Chess.Auth.Guardian do + @moduledoc false + use Guardian, otp_app: :chess alias Chess.Auth diff --git a/lib/chess/board.ex b/lib/chess/board.ex index 341a453..b4c9faa 100644 --- a/lib/chess/board.ex +++ b/lib/chess/board.ex @@ -1,4 +1,6 @@ defmodule Chess.Board do + @moduledoc false + def output(board) do Enum.map(0..7, fn (rank) -> Enum.map(0..7, fn (file) -> diff --git a/lib/chess/store/game.ex b/lib/chess/store/game.ex index d3e66ac..6db4ba5 100644 --- a/lib/chess/store/game.ex +++ b/lib/chess/store/game.ex @@ -1,4 +1,6 @@ defmodule Chess.Store.Game do + @moduledoc false + use Ecto.Schema use Timex.Ecto.Timestamps diff --git a/lib/chess_web/controllers/game_controller.ex b/lib/chess_web/controllers/game_controller.ex index 4420783..b12519f 100644 --- a/lib/chess_web/controllers/game_controller.ex +++ b/lib/chess_web/controllers/game_controller.ex @@ -5,10 +5,12 @@ defmodule ChessWeb.GameController do def index(conn, _params) do changeset = Game.changeset(%Game{}) - games = Game - |> Game.for_user(current_user(conn)) - |> Game.ordered - |> Repo.all + games = + Game + |> Game.for_user(current_user(conn)) + |> Game.ordered + |> Repo.all + render(conn, "index.html", games: games, changeset: changeset) end @@ -30,6 +32,7 @@ defmodule ChessWeb.GameController do def show(conn, %{"id" => id}) do game = Repo.get!(Game, id) + render(conn, "show.html", game: game) end