Skip to content

Commit

Permalink
1335 Resolve compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cpreisinger committed Jun 16, 2024
1 parent a35e734 commit 68d333b
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .travis/test.extra.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

config :challenge_gov, ChallengeGov.Repo,
username: "challenge_gov",
Expand Down
4 changes: 2 additions & 2 deletions DEVCONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Create the file `config/dev.local.exs` and set a secret key base, and if needed,
It will look something like (replacing with your local configuration):

```elixir
use Mix.Config
import Config

config :challenge_gov, Web.Endpoint,
secret_key_base: "<OUTPUT OF `mix phx.gen.secret`>"
Expand All @@ -77,7 +77,7 @@ Create the file `config/test.local.exs` and set a secret key base, and if needed
It will look something like (replacing with your local configuration):

```elixir
use Mix.Config
import Config

config :challenge_gov, Web.Endpoint,
secret_key_base: "<OUTPUT OF `mix phx.gen.secret`>"
Expand Down
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# is restricted to this project.

# General application configuration
use Mix.Config
import Config

config :challenge_gov,
namespace: Web,
Expand Down
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

# For development, we disable any cache and enable
# debugging and code reloading.
Expand Down
2 changes: 1 addition & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

# For production, don't forget to configure the url host
# to something meaningful, Phoenix uses this information
Expand Down
2 changes: 1 addition & 1 deletion config/test.circleci.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

config :challenge_gov, Web.Endpoint, secret_key_base: System.get_env("SECRET_KEY_BASE")

Expand Down
2 changes: 1 addition & 1 deletion config/test.drone.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

config :challenge_gov, Web.Endpoint, secret_key_base: System.get_env("SECRET_KEY_BASE")

Expand Down
4 changes: 2 additions & 2 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

# We don't run a server during test. If one is required,
# you can enable the server option below.
Expand All @@ -7,7 +7,7 @@ config :challenge_gov, Web.Endpoint,
server: false

# Print only warnings and errors during test
config :logger, level: :warn
config :logger, level: :warning

# Configure your database
config :challenge_gov, ChallengeGov.Repo,
Expand Down
2 changes: 1 addition & 1 deletion lib/challenge_gov/certification_logs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ defmodule ChallengeGov.CertificationLogs do
defp maybe_send_email(%{renewal_request: "certification"}, _days), do: :noop

defp maybe_send_email(user, days) do
Logger.warn("Decertify #{days} day notice [user_id: #{user.id}]")
Logger.warning("Decertify #{days} day notice [user_id: #{user.id}]")
send_email(user, days)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/challenge_gov/gov_delivery.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule ChallengeGov.GovDelivery do
@callback send_bulletin(challenge(), binary(), binary()) :: tuple()
@callback get_topic_subscribe_count(challenge()) :: tuple()

@module Application.get_env(:challenge_gov, :gov_delivery)[:module]
@module Application.compile_env(:challenge_gov, [:gov_delivery, :module])

@doc """
Get the username for GovDelivery
Expand Down
2 changes: 1 addition & 1 deletion lib/challenge_gov/recaptcha.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule ChallengeGov.Recaptcha do

@callback valid_token?(token()) :: tuple()

@module Application.get_env(:challenge_gov, :recaptcha)[:module]
@module Application.compile_env(:challenge_gov, [:recaptcha, :module])

@doc """
Get the site key for recaptcha
Expand Down
12 changes: 6 additions & 6 deletions lib/challenge_gov/submission_documents.ex
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ defmodule ChallengeGov.SubmissionDocuments do
end
end

defp not_valid_characters(input_string) do
# characters to replace
to_replace = ~w"/ \\ | # % @ ^ : ? ! & % * $ = < > { }"
String.replace(input_string, to_replace, fn _ -> "-" end)
end

def upload(user, _) do
user
|> Ecto.build_assoc(:submission_documents)
Expand All @@ -81,6 +75,12 @@ defmodule ChallengeGov.SubmissionDocuments do
|> Ecto.Changeset.apply_action(:insert)
end

defp not_valid_characters(input_string) do
# characters to replace
to_replace = ~w"/ \\ | # % @ ^ : ? ! & % * $ = < > { }"
String.replace(input_string, to_replace, fn _ -> "-" end)
end

@doc """
Delete a document
Expand Down
4 changes: 2 additions & 2 deletions lib/challenge_gov/submissions/submission.ex
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ defmodule ChallengeGov.Submissions.Submission do
|> validate_file_upload(challenge, params)
end

def update_draft_changeset(struct, params, challenge) do
def update_draft_changeset(struct, params, _challenge) do
struct
|> changeset(params)
|> put_change(:status, "draft")
Expand All @@ -149,7 +149,7 @@ defmodule ChallengeGov.Submissions.Submission do
|> validate_review_verify(params)
|> validate_terms(params)
|> validate_required([:title, :brief_description, :description])
# Validate file upload on update review.
# Validate file upload on update review.
|> validate_file_upload(challenge, params)
end

Expand Down
4 changes: 2 additions & 2 deletions lib/web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Web.Endpoint do
plug RemoteIp
plug CORSPlug

if Application.get_env(:challenge_gov, :sql_sandbox) do
if Application.compile_env(:challenge_gov, :sql_sandbox) do
plug Phoenix.Ecto.SQL.Sandbox
end

Expand All @@ -31,7 +31,7 @@ defmodule Web.Endpoint do
only: ~w(css fonts images js favicon.ico robots.txt pdfs assets)

# Serve local assets via URLs generated by Waffle.Actions.Url
if Application.get_env(:challenge_gov, :serve_static_waffle_assets) do
if Application.compile_env(:challenge_gov, :serve_static_waffle_assets) do
plug Plug.Static,
at: "/waffle",
from: Path.expand("../../priv/waffle/uploads", __DIR__),
Expand Down
2 changes: 1 addition & 1 deletion lib/web/templates/challenge/show/_button_bar.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<%= link("Request Edits", to: "#announcement-modal", class: "usa-button usa-button--secondary", "data-open-modal": "true", "aria-controls": "announcement-modal") %>
<% end %>
<%#= if Challenges.can_post_announcement?(@challenge, @user) do %>
<%= link("Add/Edit Update", to: "#", class: "usa-button", ) %>
<%= link("Add/Edit Update", to: "#", class: "usa-button" ) %>
<%# end %>
<%= if Challenges.is_submittable?(@challenge, @user) do %>
<%= link("Submit", to: Routes.challenge_path(@conn, :submit, @challenge.id), method: :post, class: "usa-button", data: [confirm: "Are you sure you want to submit this challenge for approval?"]) %>
Expand Down
2 changes: 1 addition & 1 deletion lib/web/templates/challenge/wizard.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="usa-card__container">
<%= hidden_input f, :section, value: @section %>
<%= hidden_input f, :user_id, value: @user.id %>
<%= hidden_input f, :challenge_id, value: if @challenge, do: @challenge.id, else: nil %>
<%= hidden_input f, :challenge_id, value: (if @challenge, do: @challenge.id, else: nil) %>
<%= hidden_input f, :local_timezone, id: "local-timezone-input" %>

<div class="usa-card__body">
Expand Down
6 changes: 3 additions & 3 deletions lib/web/views/challenge_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -460,17 +460,17 @@ defmodule Web.ChallengeView do
sections = Challenges.sections()
current_section_index = Challenges.section_index(current_section)

progressbar_width = current_section_index / length(sections) * 110
_progressbar_width = current_section_index / length(sections) * 110

base_classes = ""
_base_classes = ""

content_tag :div,
class: " usa-step-indicator usa-step-indicator--counters",
style: "padding:1rem;",
aria: [label: "progress"] do
content_tag :ol, class: "usa-step-indicator__segments" do
[
Enum.map(Enum.with_index(sections), fn {section, index} ->
Enum.map(Enum.with_index(sections), fn {section, _index} ->
[
cond do
section.id == current_section ->
Expand Down
2 changes: 1 addition & 1 deletion lib/web/views/submission_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ defmodule Web.SubmissionView do
end
end

def cancel_button(conn, action, challenge, phase, user, opts \\ []) do
def cancel_button(conn, action, challenge, phase, user, _opts \\ []) do
route =
cond do
Accounts.has_admin_access?(user) ->
Expand Down

0 comments on commit 68d333b

Please sign in to comment.