Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elixir upgrade 1.18 #612

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/dialyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
# Sets the ENV `MIX_ENV` to `test` for running tests
env:
MIX_ENV: test
ELIXIR_VER: '1.16.3'
ELIXIR_VER: '1.18.2'
OTP_VER: '26.2.5.2'

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
# Sets the ENV `MIX_ENV` to `test` for running tests
env:
MIX_ENV: test
ELIXIR_VER: '1.16.3'
ELIXIR_VER: '1.18.2'
OTP_VER: '26.2.5.2'

permissions:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
# Sets the ENV `MIX_ENV` to `test` for running tests
env:
MIX_ENV: test
ELIXIR_VER: '1.16.3'
ELIXIR_VER: '1.18.2'
OTP_VER: '26.2.5.2'

permissions:
Expand Down Expand Up @@ -110,4 +110,4 @@ jobs:
run: echo "LINES RELEVANT MISSED" | tee -a ./cover/files_changed_in_last_month.txt

- name: use grep to create test coverage report only on recently changed files, sorted by coverage percent
run: grep -F -f ./cover/files_changed_in_last_month.txt ./cover/test_coverage_by_file.txt | grep -A999 "LINES RELEVANT MISSED" | sort -g
run: grep -F -f ./cover/files_changed_in_last_month.txt ./cover/test_coverage_by_file.txt | grep -A999 "LINES RELEVANT MISSED" | sort -g
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 26.2.5.2
elixir 1.16.3-otp-26
elixir 1.18.2-otp-26
8 changes: 1 addition & 7 deletions assets/scss/custom/_styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ body {
margin: -1rem 0 2rem;
}

/* LiveView specific classes for your customization */
.phx-no-feedback.invalid-feedback,
.phx-no-feedback .invalid-feedback {
display: none;
}

.phx-click-loading {
opacity: 0.5;
transition: opacity 1s ease-out;
Expand Down Expand Up @@ -396,4 +390,4 @@ input[type="color"] {

.control-label {
font-weight: bold;
}
}
10 changes: 5 additions & 5 deletions lib/central/input_helper.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule Central.Helpers.InputHelper do
@moduledoc false

use Phoenix.HTML
alias Phoenix.HTML.Form
import Phoenix.HTML.Form
use PhoenixHTMLHelpers

# http://blog.plataformatec.com.br/2016/09/dynamic-forms-with-phoenix/
def input_with_type(form, field, type) do
Expand Down Expand Up @@ -31,7 +31,7 @@ defmodule Central.Helpers.InputHelper do
end

def input(form, field, opts \\ []) do
type = opts[:using] || Form.input_type(form, field)
type = opts[:using]

wrapper_opts = [class: "form-group #{state_class(form, field)}"]
label_opts = [class: "control-label"]
Expand Down Expand Up @@ -70,9 +70,9 @@ defmodule Central.Helpers.InputHelper do
content_tag :div, wrapper_opts do
input =
if type == :select do
apply(Phoenix.HTML.Form, type, [form, field, choices, input_opts])
apply(PhoenixHTMLHelpers.Form, type, [form, field, choices, input_opts])
else
apply(Phoenix.HTML.Form, type, [form, field, input_opts])
apply(PhoenixHTMLHelpers.Form, type, [form, field, input_opts])
end

label = label(form, field, humanize(field), label_opts)
Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/account/libs/accolade_lib.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ defmodule Teiserver.Account.AccoladeLib do
type_icon: icon(),
item_id: accolade.id,
item_type: "teiserver_account_accolade",
item_colour: colours() |> elem(0),
item_colour: StylingHelper.colours(colours()) |> elem(0),
item_icon: Teiserver.Account.AccoladeLib.icon(),
item_label: "#{accolade.name}",
url: "/account/accolades/#{accolade.id}"
Expand Down
4 changes: 3 additions & 1 deletion lib/teiserver/account/reports/accolade_report.ex
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ defmodule Teiserver.Account.AccoladeReport do
defp get_recipient_leaderboard(accolades, positions) do
accolades
|> Enum.group_by(fn a -> a.badge_type_id end)
|> Map.new(fn {b_id, accs} -> {b_id, get_recipient_leaderboard_for_badge(accs, positions)} end)
|> Map.new(fn {b_id, accs} ->
{b_id, get_recipient_leaderboard_for_badge(accs, positions)}
end)
end

defp get_recipient_leaderboard_for_badge(accolades, positions) do
Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/account/reports/retention_report.ex
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ defmodule Teiserver.Account.RetentionReport do
end
end)

if last_login != nil and last_played != nil do
if last_played != nil do
%{
last_login: Timex.diff(user.inserted_at, last_login, :days) |> abs,
last_played: Timex.diff(user.inserted_at, last_played, :days) |> abs
Expand Down
10 changes: 1 addition & 9 deletions lib/teiserver/account/tasks/merge_accounts_task.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,7 @@ defmodule Teiserver.Account.MergeAccountsTask do

# Reports

result = Teiserver.Admin.DeleteUserTask.delete_users([deleting_id])

case result do
{:ok, _} ->
:ok

{:error, error} ->
Logger.error("Error merging #{deleting_id} into #{keeping_id}\n#{Kernel.inspect(error)}")
end
Teiserver.Admin.DeleteUserTask.delete_users([deleting_id])

Account.decache_user(deleting_id)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/data/cache_user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ defmodule Teiserver.CacheUser do
:no_verify ->
verify_user(get_user_by_id(user.id))

{:ok, _, _} ->
:ok ->
:ok
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/helpers/string_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ defmodule Teiserver.Helper.StringHelper do
cond do
last_2digits == "ey" -> "#{s}s"
last_1digit == "s" -> s
last_1digit == "y" -> "#{String.slice(s, 0..-2)}ies"
last_1digit == "y" -> "#{String.slice(s, 0..-2//-1)}ies"
true -> "#{s}s"
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver/logging/tasks/persist_server_minute_task.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule Teiserver.Logging.Tasks.PersistServerMinuteTask do
|> Map.drop([:cycle])

if Teiserver.Communication.use_discord?() do
if rem(Timex.now().minute(), 10) == 0 do
if rem(Timex.now().minute, 10) == 0 do
if Config.get_site_config_cache("teiserver.Bridge player numbers") do
[
{:update_stats, :client_count, Enum.count(data.client.total)},
Expand Down
4 changes: 1 addition & 3 deletions lib/teiserver/microblog/queries/user_preference_queries.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ defmodule Teiserver.Microblog.UserPreferenceQueries do
end

@spec do_where(Ecto.Query.t(), list | map | nil) :: Ecto.Query.t()
defp do_where(query, nil), do: query

defp do_where(query, params) do
params
|> Enum.reduce(query, fn {key, value}, query_acc ->
_where(query_acc, key, value)
end)
end

@spec _where(Ecto.Query.t(), Atom.t(), any()) :: Ecto.Query.t()
@spec _where(Ecto.Query.t(), atom(), any()) :: Ecto.Query.t()
defp _where(query, _, ""), do: query
defp _where(query, _, nil), do: query

Expand Down
2 changes: 1 addition & 1 deletion lib/teiserver_web/components/autohost_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule TeiserverWeb.Components.BotComponent do
<CC.input field={f[:name]} type="text" label="Name" />

<:actions>
<CC.button type="submit" class="btn-primary"><%= @button_label %></CC.button>
<CC.button type="submit" class="btn-primary">{@button_label}</CC.button>
</:actions>
</CC.simple_form>
"""
Expand Down
Loading
Loading