Skip to content

Commit ccb942d

Browse files
authored
Merge pull request #1464 from naymspace/feature/quokka
Format code with quokka
2 parents 1873e89 + bd81b8d commit ccb942d

31 files changed

+158
-164
lines changed

.formatter.exs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ locals_without_parens = [
66
[
77
line_length: 120,
88
import_deps: [:ecto, :phoenix, :ash, :ash_postgres],
9-
plugins: [TailwindFormatter, Phoenix.LiveView.HTMLFormatter],
9+
plugins: [TailwindFormatter, Phoenix.LiveView.HTMLFormatter, Quokka],
1010
inputs: ["*.{heex,ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{heex,ex,exs}"],
1111
locals_without_parens: locals_without_parens,
12-
export: [locals_without_parens: locals_without_parens]
12+
export: [locals_without_parens: locals_without_parens],
13+
quokka: [
14+
exclude: [
15+
:module_directives
16+
]
17+
]
1318
]

config/test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import Config
22

3-
config :logger, :level, :debug
43
config :logger, :default_handler, false
4+
config :logger, :level, :debug

demo/.formatter.exs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
[
22
line_length: 120,
33
import_deps: [:ecto, :phoenix, :backpex, :ash, :ash_postgres],
4-
plugins: [Spark.Formatter, TailwindFormatter, Phoenix.LiveView.HTMLFormatter],
4+
plugins: [Spark.Formatter, TailwindFormatter, Phoenix.LiveView.HTMLFormatter, Quokka],
55
inputs: ["*.{heex,ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{heex,ex,exs}"],
6-
subdirectories: ["priv/*/migrations"]
6+
subdirectories: ["priv/*/migrations"],
7+
quokka: [
8+
exclude: [
9+
:module_directives
10+
]
11+
]
712
]

demo/config/config.exs

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
11
import Config
22

3-
config :spark,
4-
formatter: [
5-
remove_parens?: true,
6-
"Ash.Resource": [
7-
section_order: [
8-
:postgres,
9-
:resource,
10-
:code_interface,
11-
:actions,
12-
:policies,
13-
:pub_sub,
14-
:preparations,
15-
:changes,
16-
:validations,
17-
:multitenancy,
18-
:attributes,
19-
:relationships,
20-
:calculations,
21-
:aggregates,
22-
:identities
23-
]
24-
],
25-
"Ash.Domain": [section_order: [:resources, :policies, :authorization, :domain, :execution]]
26-
]
3+
config :ash, :policies, no_filter_static_forbidden_reads?: false
4+
config :ash, include_embedded_source_by_default?: false, default_page_type: :keyset
275

28-
config :demo,
29-
namespace: Demo,
30-
ecto_repos: [Demo.Repo],
31-
ash_domains: [Demo.Helpdesk],
32-
generators: [binary_id: true]
6+
config :backpex,
7+
pubsub_server: Demo.PubSub,
8+
translator_function: {DemoWeb.CoreComponents, :translate_backpex},
9+
error_translator_function: {DemoWeb.CoreComponents, :translate_error}
10+
11+
config :demo, Demo.Repo, migration_primary_key: [name: :id, type: :binary_id]
3312

3413
config :demo, DemoWeb.Endpoint,
3514
adapter: Bandit.PhoenixAdapter,
@@ -40,7 +19,13 @@ config :demo, DemoWeb.Endpoint,
4019
],
4120
pubsub_server: Demo.PubSub
4221

43-
config :demo, Demo.Repo, migration_primary_key: [name: :id, type: :binary_id]
22+
config :demo, DemoWeb.Gettext, default_locale: "en"
23+
24+
config :demo,
25+
namespace: Demo,
26+
ecto_repos: [Demo.Repo],
27+
ash_domains: [Demo.Helpdesk],
28+
generators: [binary_id: true]
4429

4530
config :esbuild,
4631
version: "0.25.9",
@@ -56,35 +41,49 @@ config :esbuild,
5641
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
5742
]
5843

59-
config :tailwind,
60-
version: "4.1.13",
61-
default: [
62-
args: ~w(
63-
--input=assets/css/app.css
64-
--output=priv/static/assets/css/app.css
65-
),
66-
cd: Path.expand("..", __DIR__)
67-
]
68-
6944
config :logger, :default_formatter,
7045
format: "$time $metadata[$level] $message\n",
7146
metadata: [:request_id]
7247

48+
config :phoenix, :json_library, Jason
49+
7350
config :sentry,
7451
enable_source_code_context: true,
7552
root_source_code_paths: [File.cwd!()]
7653

77-
config :phoenix, :json_library, Jason
78-
79-
config :demo, DemoWeb.Gettext, default_locale: "en"
80-
81-
config :ash, include_embedded_source_by_default?: false, default_page_type: :keyset
82-
83-
config :ash, :policies, no_filter_static_forbidden_reads?: false
54+
config :spark,
55+
formatter: [
56+
remove_parens?: true,
57+
"Ash.Resource": [
58+
section_order: [
59+
:postgres,
60+
:resource,
61+
:code_interface,
62+
:actions,
63+
:policies,
64+
:pub_sub,
65+
:preparations,
66+
:changes,
67+
:validations,
68+
:multitenancy,
69+
:attributes,
70+
:relationships,
71+
:calculations,
72+
:aggregates,
73+
:identities
74+
]
75+
],
76+
"Ash.Domain": [section_order: [:resources, :policies, :authorization, :domain, :execution]]
77+
]
8478

85-
config :backpex,
86-
pubsub_server: Demo.PubSub,
87-
translator_function: {DemoWeb.CoreComponents, :translate_backpex},
88-
error_translator_function: {DemoWeb.CoreComponents, :translate_error}
79+
config :tailwind,
80+
version: "4.1.13",
81+
default: [
82+
args: ~w(
83+
--input=assets/css/app.css
84+
--output=priv/static/assets/css/app.css
85+
),
86+
cd: Path.expand("..", __DIR__)
87+
]
8988

9089
import_config "#{config_env()}.exs"

demo/config/dev.exs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
import Config
22

3-
config :live_debugger,
4-
ip: {0, 0, 0, 0},
5-
port: 4007,
6-
external_url: "http://localhost:4007"
7-
83
config :demo, Demo.Repo,
94
show_sensitive_data_on_connection_error: true,
105
migration_timestamps: [type: :utc_datetime]
116

12-
config :phoenix_live_reload, :dirs, [Path.expand("../..", __DIR__)]
13-
147
config :demo, DemoWeb.Endpoint,
158
debug_errors: true,
169
code_reloader: true,
@@ -32,11 +25,17 @@ config :demo, DemoWeb.Endpoint,
3225
http: [port: 4000],
3326
reloadable_apps: [:demo, :backpex]
3427

28+
config :live_debugger,
29+
ip: {0, 0, 0, 0},
30+
port: 4007,
31+
external_url: "http://localhost:4007"
32+
3533
config :logger, :default_formatter, format: "[$level] $message\n"
3634

35+
config :phoenix, :plug_init_mode, :runtime
3736
config :phoenix, :stacktrace_depth, 20
3837

39-
config :phoenix, :plug_init_mode, :runtime
38+
config :phoenix_live_reload, :dirs, [Path.expand("../..", __DIR__)]
4039

4140
config :phoenix_live_view,
4241
debug_heex_annotations: true,

demo/config/runtime.exs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import Config
22
import System, only: [get_env: 1, get_env: 2, fetch_env!: 1]
33
import String, only: [to_integer: 1, to_atom: 1, to_existing_atom: 1]
44

5-
config :demo,
6-
dns_cluster_query: get_env("DNS_CLUSTER_QUERY"),
7-
analytics: get_env("ANALYTICS", "false") |> to_existing_atom()
8-
95
config :demo, Demo.Repo,
106
hostname: get_env("DB_HOSTNAME", "postgres"),
117
username: get_env("DB_USERNAME", "postgres"),
@@ -14,6 +10,11 @@ config :demo, Demo.Repo,
1410
port: get_env("DB_PORT", "5432") |> to_integer(),
1511
pool_size: get_env("DB_POOL_SIZE", "5") |> to_integer()
1612

13+
config :demo, DemoWeb.DashboardAuthPlug,
14+
enabled: get_env("DASHBOARD_AUTH_ENABLED", "false") |> to_existing_atom(),
15+
username: get_env("DASHBOARD_AUTH_USERNAME", "backpex"),
16+
password: get_env("DASHBOARD_AUTH_PASSWORD", "backpex")
17+
1718
config :demo, DemoWeb.Endpoint,
1819
http: [
1920
port: get_env("PORT", "4000") |> to_integer()
@@ -28,10 +29,9 @@ config :demo, DemoWeb.Endpoint,
2829
signing_salt: fetch_env!("LIVE_VIEW_SIGNING_SALT")
2930
]
3031

31-
config :demo, DemoWeb.DashboardAuthPlug,
32-
enabled: get_env("DASHBOARD_AUTH_ENABLED", "false") |> to_existing_atom(),
33-
username: get_env("DASHBOARD_AUTH_USERNAME", "backpex"),
34-
password: get_env("DASHBOARD_AUTH_PASSWORD", "backpex")
32+
config :demo,
33+
dns_cluster_query: get_env("DNS_CLUSTER_QUERY"),
34+
analytics: get_env("ANALYTICS", "false") |> to_existing_atom()
3535

3636
config :logger, level: get_env("LOGGER_LEVEL", "debug") |> to_atom()
3737

demo/config/test.exs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import Config
22

3-
config :demo, DemoWeb.Endpoint, server: false
4-
53
config :demo, Demo.Repo, pool: Ecto.Adapters.SQL.Sandbox
4+
config :demo, DemoWeb.Endpoint, server: true
65

76
config :phoenix, :plug_init_mode, :runtime
87

@@ -15,5 +14,3 @@ config :phoenix_test,
1514
browser_launch_timeout: 10_000,
1615
trace: System.get_env("PW_TRACE", "false") in ~w(t true)
1716
]
18-
19-
config :demo, DemoWeb.Endpoint, server: true

demo/lib/demo_web/live/film_review_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ defmodule DemoWeb.FilmReviewLive do
3434
@impl Backpex.LiveResource
3535
def item_actions(default_actions) do
3636
default_actions
37-
|> Keyword.drop([:delete])
37+
|> Keyword.delete(:delete)
3838
end
3939

4040
@impl Backpex.LiveResource

demo/lib/demo_web/live/invoice_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defmodule DemoWeb.InvoiceLive do
2121
@impl Backpex.LiveResource
2222
def item_actions(default_actions) do
2323
default_actions
24-
|> Keyword.drop([:delete])
24+
|> Keyword.delete(:delete)
2525
end
2626

2727
@impl Backpex.LiveResource

demo/lib/demo_web/live/user_live.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ defmodule DemoWeb.UserLive do
4848
@impl Backpex.LiveResource
4949
def item_actions(default_actions) do
5050
default_actions
51-
|> Keyword.drop([:delete])
51+
|> Keyword.delete(:delete)
5252
|> Enum.concat(user_soft_delete: %{module: DemoWeb.ItemActions.UserSoftDelete})
5353
end
5454

0 commit comments

Comments
 (0)