Compare commits
2 Commits
60cfb137f2
...
34d1589d67
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34d1589d67 | ||
|
|
f1c2d8b232 |
BIN
.nono.sh.swp
Normal file
BIN
.nono.sh.swp
Normal file
Binary file not shown.
4
Makefile
4
Makefile
@ -5,7 +5,7 @@
|
|||||||
# Common check target that runs all static analysis
|
# Common check target that runs all static analysis
|
||||||
check:
|
check:
|
||||||
@echo "Running static analysis..."
|
@echo "Running static analysis..."
|
||||||
@make -C app MISE_BIN=/home/vscode/.local/bin/mise check
|
@make -C app MISE_BIN=mise check
|
||||||
|
|
||||||
# Precommit target for CI/pre-commit hooks
|
# Precommit target for CI/pre-commit hooks
|
||||||
precommit: check
|
precommit: check
|
||||||
@ -24,4 +24,4 @@ test:
|
|||||||
|
|
||||||
# Format code
|
# Format code
|
||||||
format:
|
format:
|
||||||
@make -C app format
|
@make -C app format
|
||||||
|
|||||||
@ -24,7 +24,11 @@ defmodule Firehose.Checks.NoConnShadowing do
|
|||||||
|> Enum.reverse()
|
|> Enum.reverse()
|
||||||
end
|
end
|
||||||
|
|
||||||
defp traverse({:=, meta, [{:conn, _, _}, {verb, _, [{:conn, _, _} | _]}]} = ast, issues, issue_meta)
|
defp traverse(
|
||||||
|
{:=, meta, [{:conn, _, _}, {verb, _, [{:conn, _, _} | _]}]} = ast,
|
||||||
|
issues,
|
||||||
|
issue_meta
|
||||||
|
)
|
||||||
when verb in @http_verbs do
|
when verb in @http_verbs do
|
||||||
issue = issue_for(issue_meta, meta[:line], verb)
|
issue = issue_for(issue_meta, meta[:line], verb)
|
||||||
{ast, [issue | issues]}
|
{ast, [issue | issues]}
|
||||||
@ -37,7 +41,8 @@ defmodule Firehose.Checks.NoConnShadowing do
|
|||||||
defp issue_for(issue_meta, line_no, verb) do
|
defp issue_for(issue_meta, line_no, verb) do
|
||||||
format_issue(
|
format_issue(
|
||||||
issue_meta,
|
issue_meta,
|
||||||
message: "Conn shadowing detected (`conn = #{verb}(conn, ...)`). Run `./refactor_conn_aliasing.sh <file>` to fix.",
|
message:
|
||||||
|
"Conn shadowing detected (`conn = #{verb}(conn, ...)`). Run `./refactor_conn_aliasing.sh <file>` to fix.",
|
||||||
line_no: line_no
|
line_no: line_no
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,8 +3,8 @@ defmodule FirehoseWeb.BlogTagsTest do
|
|||||||
|
|
||||||
defp goto_engineering_tag_page(conn, tag) do
|
defp goto_engineering_tag_page(conn, tag) do
|
||||||
path = "/blog/engineering/tag/#{tag}"
|
path = "/blog/engineering/tag/#{tag}"
|
||||||
conn = get(conn, path)
|
conn_res = get(conn, path)
|
||||||
body = html_response(conn, 200)
|
body = html_response(conn_res, 200)
|
||||||
assert body =~ ~s(tagged "#{tag}")
|
assert body =~ ~s(tagged "#{tag}")
|
||||||
assert body =~ "Engineering Blog"
|
assert body =~ "Engineering Blog"
|
||||||
body
|
body
|
||||||
@ -12,8 +12,8 @@ defmodule FirehoseWeb.BlogTagsTest do
|
|||||||
|
|
||||||
defp goto_releases_tag_page(conn, tag) do
|
defp goto_releases_tag_page(conn, tag) do
|
||||||
path = "/blog/releases/tag/#{tag}"
|
path = "/blog/releases/tag/#{tag}"
|
||||||
conn = get(conn, path)
|
conn_res = get(conn, path)
|
||||||
body = html_response(conn, 200)
|
body = html_response(conn_res, 200)
|
||||||
assert body =~ ~s(tagged "#{tag}")
|
assert body =~ ~s(tagged "#{tag}")
|
||||||
assert body =~ "Release Notes"
|
assert body =~ "Release Notes"
|
||||||
body
|
body
|
||||||
@ -33,8 +33,8 @@ defmodule FirehoseWeb.BlogTagsTest do
|
|||||||
test "GET /blog/engineering/tag/:tag page shows empty list for nonexistent tag", %{
|
test "GET /blog/engineering/tag/:tag page shows empty list for nonexistent tag", %{
|
||||||
conn: conn
|
conn: conn
|
||||||
} do
|
} do
|
||||||
body = get(conn, "/blog/engineering/tag/nonexistent-tag")
|
conn_res = get(conn, "/blog/engineering/tag/nonexistent-tag")
|
||||||
assert html_response(body, 200) =~ ~s(tagged "nonexistent-tag")
|
assert html_response(conn_res, 200) =~ ~s(tagged "nonexistent-tag")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -45,30 +45,30 @@ defmodule FirehoseWeb.BlogTagsTest do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "GET /blog/releases/tag/:tag page shows filtered posts", %{conn: conn} do
|
test "GET /blog/releases/tag/:tag page shows filtered posts", %{conn: conn} do
|
||||||
body = get(conn, "/blog/releases/tag/nonexistent-tag")
|
conn_res = get(conn, "/blog/releases/tag/nonexistent-tag")
|
||||||
assert html_response(body, 200) =~ ~s(tagged "nonexistent-tag")
|
assert html_response(conn_res, 200) =~ ~s(tagged "nonexistent-tag")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "tag URL pattern" do
|
describe "tag URL pattern" do
|
||||||
test "tag URLs follow pattern /blog/:blog_id/tag/:tag for engineering blog", %{conn: conn} do
|
test "tag URLs follow pattern /blog/:blog_id/tag/:tag for engineering blog", %{conn: conn} do
|
||||||
# Test that the tag route exists and works correctly
|
# Test that the tag route exists and works correctly
|
||||||
conn = get(conn, "/blog/engineering/tag/elixir")
|
conn_res1 = get(conn, "/blog/engineering/tag/elixir")
|
||||||
assert html_response(conn, 200) =~ ~s(tagged "elixir")
|
assert html_response(conn_res1, 200) =~ ~s(tagged "elixir")
|
||||||
|
|
||||||
conn = get(conn, "/blog/engineering/tag/phoenix")
|
conn_res2 = get(conn, "/blog/engineering/tag/phoenix")
|
||||||
assert html_response(conn, 200) =~ ~s(tagged "phoenix")
|
assert html_response(conn_res2, 200) =~ ~s(tagged "phoenix")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "tag URLs follow pattern /blog/:blog_id/tag/:tag for releases blog", %{conn: conn} do
|
test "tag URLs follow pattern /blog/:blog_id/tag/:tag for releases blog", %{conn: conn} do
|
||||||
# Test that the tag route exists and works correctly
|
# Test that the tag route exists and works correctly
|
||||||
conn = get(conn, "/blog/releases/tag/release")
|
conn_res = get(conn, "/blog/releases/tag/release")
|
||||||
assert html_response(conn, 200) =~ ~s(tagged "release")
|
assert html_response(conn_res, 200) =~ ~s(tagged "release")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "nonexistent tags return 200 with empty post list", %{conn: conn} do
|
test "nonexistent tags return 200 with empty post list", %{conn: conn} do
|
||||||
conn = get(conn, "/blog/engineering/tag/nonexistent-tag")
|
conn_res = get(conn, "/blog/engineering/tag/nonexistent-tag")
|
||||||
assert html_response(conn, 200)
|
assert html_response(conn_res, 200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -94,30 +94,30 @@ defmodule FirehoseWeb.BlogTagsTest do
|
|||||||
test "tags are rendered as clickable links on engineering blog index", %{
|
test "tags are rendered as clickable links on engineering blog index", %{
|
||||||
conn: conn
|
conn: conn
|
||||||
} do
|
} do
|
||||||
conn = get(conn, "/blog/engineering")
|
conn_res1 = get(conn, "/blog/engineering")
|
||||||
body = html_response(conn, 200)
|
body1 = html_response(conn_res1, 200)
|
||||||
|
|
||||||
# Verify tag links exist with correct href pattern
|
# Verify tag links exist with correct href pattern
|
||||||
assert body =~ ~r{href="/blog/engineering/tag/meta"}
|
assert body1 =~ ~r{href="/blog/engineering/tag/meta"}
|
||||||
assert body =~ ~r{href="/blog/engineering/tag/ai"}
|
assert body1 =~ ~r{href="/blog/engineering/tag/ai"}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "tags are rendered as clickable links on releases blog index", %{
|
test "tags are rendered as clickable links on releases blog index", %{
|
||||||
conn: conn
|
conn: conn
|
||||||
} do
|
} do
|
||||||
conn = get(conn, "/blog/releases")
|
conn_res2 = get(conn, "/blog/releases")
|
||||||
body = html_response(conn, 200)
|
body2 = html_response(conn_res2, 200)
|
||||||
|
|
||||||
# Verify tag link exists
|
# Verify tag link exists
|
||||||
assert body =~ ~r{href="/blog/releases/tag/release"}
|
assert body2 =~ ~r{href="/blog/releases/tag/release"}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "tag links have proper styling classes", %{conn: conn} do
|
test "tag links have proper styling classes", %{conn: conn} do
|
||||||
conn = get(conn, "/blog/engineering")
|
conn_res3 = get(conn, "/blog/engineering")
|
||||||
body = html_response(conn, 200)
|
body3 = html_response(conn_res3, 200)
|
||||||
|
|
||||||
# Verify blogex-tag-link class is present for tag links
|
# Verify blogex-tag-link class is present for tag links
|
||||||
assert body =~ ~r{class="[^"]*blogex-tag-link}
|
assert body3 =~ ~r{class="[^"]*blogex-tag-link}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
3
nono.sh
3
nono.sh
@ -5,6 +5,7 @@ nono run \
|
|||||||
--allow /Users/willem/.local/share/mise \
|
--allow /Users/willem/.local/share/mise \
|
||||||
--allow /Users/willem/.pi \
|
--allow /Users/willem/.pi \
|
||||||
--read /Users/willem/.git \
|
--read /Users/willem/.git \
|
||||||
|
--read-file /Users/willem/.gitconfig \
|
||||||
--allow /Users/willem/Library/Caches/mise \
|
--allow /Users/willem/Library/Caches/mise \
|
||||||
--allow-net \
|
--allow-net \
|
||||||
-- pi --verbose -p 'write a haiku'
|
-- pi --verbose
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user