chore: apply credo suggestions (#3)
Some checks reported errors
continuous-integration/drone/push Build encountered an error

Mainly add module docs and fix some aliases.
This commit is contained in:
2022-04-22 00:49:00 +00:00
parent 49bafee50c
commit 410a509faa
20 changed files with 67 additions and 13 deletions

View File

@@ -1,4 +1,7 @@
defmodule Wabanex.Exercise do
@moduledoc """
Schema of a exercise contained within a training.
"""
use Ecto.Schema
import Ecto.Changeset

View File

@@ -1,4 +1,8 @@
defmodule Wabanex.IMC do
@moduledoc """
Body mass index calculation
"""
def calculate(%{"filename" => filename}) do
filename
|> File.read()
@@ -7,11 +11,7 @@ defmodule Wabanex.IMC do
defp handle_file({:ok, content}) do
data =
content
|> String.trim()
|> String.split("\n")
|> Enum.map(&parse_line/1)
|> Enum.into(%{})
content |> String.trim() |> String.split("\n") |> Enum.map(&parse_line/1) |> Enum.into(%{})
{:ok, data}
end

View File

@@ -1,4 +1,7 @@
defmodule Wabanex.Training do
@moduledoc """
Schema of a training routine for a given period of time.
"""
use Ecto.Schema
import Ecto.Changeset

View File

@@ -1,5 +1,8 @@
defmodule Wabanex.Trainings.Create do
alias Wabanex.{Training, Repo}
@moduledoc """
Context to create a training routine.
"""
alias Wabanex.{Repo, Training}
def call(params) do
params

View File

@@ -1,4 +1,7 @@
defmodule Wabanex.User do
@moduledoc """
Schema of a user in the system.
"""
use Ecto.Schema
import Ecto.Changeset

View File

@@ -1,4 +1,7 @@
defmodule Wabanex.Users.Create do
@moduledoc """
Context for user creation.
"""
alias Wabanex.{Repo, User}
def call(params) do

View File

@@ -1,4 +1,7 @@
defmodule Wabanex.Users.Get do
@moduledoc """
Context to fetch a given user and its current training.
"""
import Ecto.Query
alias Wabanex.{Repo, Training, User}