Skip to content

Commit

Permalink
use ! in names
Browse files Browse the repository at this point in the history
  • Loading branch information
panentheos committed May 2, 2024
1 parent 70a3fe4 commit 91969e0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions lib/screenplay/outfront_takeover_tool/alerts/local_fetch.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ defmodule Screenplay.OutfrontTakeoverTool.Alerts.LocalFetch do
@moduledoc false

# sobelow_skip ["Traversal.FileModule"]
@spec get_state() :: binary()
def get_state do
@spec get_state!() :: binary()
def get_state! do
file_path() |> File.read!()
end

# sobelow_skip ["Traversal.FileModule"]
@spec put_state(binary()) :: :ok
def put_state(state) do
@spec put_state!(binary()) :: :ok
def put_state!(state) do
file_path() |> File.write!(state)
:ok
end
Expand Down
8 changes: 4 additions & 4 deletions lib/screenplay/outfront_takeover_tool/alerts/s3_fetch.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
defmodule Screenplay.OutfrontTakeoverTool.Alerts.S3Fetch do
@moduledoc false

@spec get_state() :: binary()
def get_state do
@spec get_state!() :: binary()
def get_state! do
%{body: body, status_code: 200} = ExAws.S3.get_object(bucket(), path()) |> ExAws.request!()
body
end

@spec put_state(binary()) :: :ok
def put_state(state) do
@spec put_state!(binary()) :: :ok
def put_state!(state) do
%{status_code: 200} = ExAws.S3.put_object(bucket(), path(), state) |> ExAws.request!()
:ok
end
Expand Down
4 changes: 2 additions & 2 deletions lib/screenplay/outfront_takeover_tool/alerts/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ defmodule Screenplay.OutfrontTakeoverTool.Alerts.State do
case opts do
:ok ->
fetch_module = Application.get_env(:screenplay, :alerts_fetch_module)
init_state = fetch_module.get_state() |> Jason.decode!() |> from_json()
init_state = fetch_module.get_state!() |> Jason.decode!() |> from_json()

{:ok, init_state}

Expand Down Expand Up @@ -250,7 +250,7 @@ defmodule Screenplay.OutfrontTakeoverTool.Alerts.State do

defp save_state(new_state) do
fetch_module = Application.get_env(:screenplay, :alerts_fetch_module)
new_state |> to_json() |> Jason.encode!(pretty: true) |> fetch_module.put_state()
new_state |> to_json() |> Jason.encode!(pretty: true) |> fetch_module.put_state!()
end

defp get_overlapping_stations(existing_alerts, new_id, new_stations) do
Expand Down
8 changes: 4 additions & 4 deletions lib/screenplay/outfront_takeover_tool/alerts/test_fetch.ex
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
defmodule Screenplay.OutfrontTakeoverTool.Alerts.TestFetch do
@moduledoc false

@spec get_state() :: binary()
def get_state do
@spec get_state!() :: binary()
def get_state! do
File.read!("test/fixtures/alerts.json")
end

@spec put_state(binary()) :: :ok
def put_state(_state) do
@spec put_state!(binary()) :: :ok
def put_state!(_state) do
:ok
end
end

0 comments on commit 91969e0

Please sign in to comment.