Skip to content

Commit

Permalink
Fixing dialyzer errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomanuel committed Mar 19, 2023
1 parent e81f077 commit dc17463
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
run: mix format --check-formatted
- name: Run tests
run: mix test
- name: Run dialyzer
run: mix dialyzer --check=true --compile=true

- name: Build release
run: |
Expand Down Expand Up @@ -104,7 +106,7 @@ jobs:
- name: Commit VERSION file
run: |
git add VERSION
git config --local user.name "coophub-ci"
git config --local user.name "fiqus-ci"
git config --local user.email "ci@fiqus.coop"
git commit -m "Bump to $RELEASE_TAG"
- name: Push VERSION file
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ jobs:
run: mix format --check-formatted
- name: Run tests
run: mix test
- name: Run dialyzer
run: mix dialyzer --check=true --compile=true
4 changes: 2 additions & 2 deletions lib/coophub/cache_warmer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule Coophub.CacheWarmer do
@doc """
Executes this cache warmer.
"""
@spec execute(any) :: :ignore | {:ok, list({atom, Repos.org()}), keyword}
@spec execute(any) :: :ignore | {:ok, list({binary, Repos.org()}), keyword}
def execute(_state) do
## Delay the execution a bit to ensure Cachex is available
Process.sleep(2000)
Expand Down Expand Up @@ -194,7 +194,7 @@ defmodule Coophub.CacheWarmer do
defp get_org(key, %{"source" => source} = yml_data) do
case Backends.get_org(source, key, yml_data) do
%Organization{} = org ->
%Organization{org | cached_at: DateTime.utc_now()}
%Organization{org | cached_at: DateTime.utc_now() |> DateTime.to_iso8601()}

error ->
Logger.error("Couldn't get org data: #{inspect(error)}")
Expand Down
2 changes: 1 addition & 1 deletion lib/coophub/repos.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule Coophub.Repos do
Orgs is a list of org maps
"""
@type orgs :: list(org()) | []
@type orgs_map :: %{required(String.t()) => org()}
@type orgs_map :: %{required(binary) => org()}

@spec get_all_orgs :: orgs_map() | :error
def get_all_orgs() do
Expand Down
10 changes: 6 additions & 4 deletions lib/coophub_web/controllers/fallback_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ defmodule CoophubWeb.FallbackController do
def call(conn, {:error, :not_found}) do
conn
|> put_status(:not_found)
|> render(CoophubWeb.ErrorView, :"404")
|> put_view(CoophubWeb.ErrorView)
|> render(:"404")
end

def call(conn, {:error, _}) do
def call(conn, _error) do
conn
|> put_status(:unprocessable_entity)
|> render(CoophubWeb.ChangesetView, "error.json")
|> put_status(:internal_server_error)
|> put_view(CoophubWeb.ErrorView)
|> render(:"500")
end
end

0 comments on commit dc17463

Please sign in to comment.