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

Fix Credo Trailing Whitespace #630

Merged
merged 3 commits into from
Oct 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/event_emitter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ defmodule EventEmitter do
@moduledoc false
# This module offers telemetry style event emission for testing purposes.

# If you'd like to emit a message to the event stream, you can call `emit/1` from your implementation code. This is macro, and will not result in any AST injection when not being compiled in the test env.
# If you'd like to emit a message to the event stream, you can call `emit/1` from your
# implementation code. This is macro, and will not result in any AST injection when not being
# compiled in the test env.

# ```elixir
# defmodule ImplMod do
Expand All @@ -11,12 +13,17 @@ defmodule EventEmitter do
# def implementation do
# # some logic

# emit %{name: :implementation, module: __MODULE__, metadata: %{unique_identifier: some_variable}}
# emit %{
# name: :implementation,
# module: __MODULE__,
# metadata: %{unique_identifier: some_variable}
# }
# end
# end
# ```

# If you'd like to await on a message emitted by implementation code, you can call `await/3` from your test code after registering a handler for your test process
# If you'd like to await on a message emitted by implementation code, you can call `await/3` from
# your test code after registering a handler for your test process

# ```elixir
# defmodule TestMod do
Expand Down
6 changes: 3 additions & 3 deletions lib/wallaby.ex
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ defmodule Wallaby do
"""
@spec end_session(Session.t()) :: :ok | {:error, reason}
def end_session(%Session{driver: driver} = session) do
with :ok <- SessionStore.demonitor(session),
:ok <- driver.end_session(session),
do: :ok
with :ok <- SessionStore.demonitor(session) do
driver.end_session(session)
end
end

@doc false
Expand Down
1 change: 0 additions & 1 deletion lib/wallaby/browser.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
defmodule Wallaby.Browser do
# credo:disable-for-this-file Credo.Check.Readability.TrailingWhiteSpace
@moduledoc """
The Browser module is the entrypoint for interacting with a real browser.

Expand Down
3 changes: 1 addition & 2 deletions lib/wallaby/helpers/key_codes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ defmodule Wallaby.Helpers.KeyCodes do
unicode =
keys
|> Enum.reduce([], fn x, acc -> acc ++ split_strings(x) end)
|> Enum.map(&"\"#{code(&1)}\"")
|> Enum.join(",")
|> Enum.map_join(",", &"\"#{code(&1)}\"")

"{\"value\": [#{unicode}]}"
end
Expand Down
6 changes: 3 additions & 3 deletions lib/wallaby/httpclient.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ defmodule Wallaby.HTTPClient do

{:ok, %HTTPoison.Response{body: body}} ->
with {:ok, decoded} <- Jason.decode(body),
{:ok, response} <- check_status(decoded),
{:ok, validated} <- check_for_response_errors(response),
do: {:ok, validated}
{:ok, response} <- check_status(decoded) do
check_for_response_errors(response)
end
end
end

Expand Down
9 changes: 5 additions & 4 deletions lib/wallaby/selenium.ex
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ defmodule Wallaby.Selenium do

@doc false
def current_path(%Session{} = session) do
with {:ok, url} <- WebdriverClient.current_url(session),
uri <- URI.parse(url),
{:ok, path} <- Map.fetch(uri, :path),
do: {:ok, path}
with {:ok, url} <- WebdriverClient.current_url(session) do
url
|> URI.parse()
|> Map.fetch(:path)
end
end

@doc false
Expand Down