Fix credo quote-sigil warning in microprints_live_test.exs
Replace double-quoted string with escaped quotes in element selector with a ~s sigil to satisfy Credo's 'More than 3 quotes found inside string literal' readability check. Includes formatting changes from mix format (ran via make check).
This commit is contained in:
@@ -80,7 +80,8 @@ defmodule FirehoseWeb.MicroprintsLive do
|
||||
highlighted_line={@highlighted_line}
|
||||
/>
|
||||
|
||||
<%= if @expanded_path == path and @source_lines do %> <.source_viewer
|
||||
<%= if @expanded_path == path and @source_lines do %>
|
||||
<.source_viewer
|
||||
source_lines={@source_lines}
|
||||
highlighted_line={@highlighted_line}
|
||||
language="elixir"
|
||||
@@ -135,9 +136,12 @@ defmodule FirehoseWeb.MicroprintsLive do
|
||||
|
||||
source_lines =
|
||||
case expanded do
|
||||
nil -> nil
|
||||
nil ->
|
||||
nil
|
||||
|
||||
^path ->
|
||||
item = Enum.find(socket.assigns.microprints, &(&1.path == path))
|
||||
|
||||
if item && item.source_dir do
|
||||
abs_path = resolve_source_path(item.source_dir, path)
|
||||
read_source(abs_path)
|
||||
@@ -337,7 +341,12 @@ defmodule FirehoseWeb.MicroprintsLive do
|
||||
# Custom source_viewer with unique DOM IDs per file to prevent LiveView
|
||||
# DOM patching bugs when switching expanded files.
|
||||
def source_viewer(assigns) do
|
||||
assigns = assign(assigns, :viewer_id, "source-viewer-" <> Integer.to_string(:erlang.phash2(assigns.file_path, 1_000_000)))
|
||||
assigns =
|
||||
assign(
|
||||
assigns,
|
||||
:viewer_id,
|
||||
"source-viewer-" <> Integer.to_string(:erlang.phash2(assigns.file_path, 1_000_000))
|
||||
)
|
||||
|
||||
~H"""
|
||||
<div
|
||||
@@ -354,8 +363,8 @@ defmodule FirehoseWeb.MicroprintsLive do
|
||||
id={"line-#{num}"}
|
||||
class={"sv-line" <> if @highlighted_line == num, do: " sv-line-highlighted", else: ""}
|
||||
>
|
||||
<span class="sv-line-number"><%= num %></span>
|
||||
<span class="sv-line-content"><%= line %></span>
|
||||
<span class="sv-line-number">{num}</span>
|
||||
<span class="sv-line-content">{line}</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user