Skip to content

Commit f0ba9b4

Browse files
committed
Reformat source code with line_length 119
1 parent c19fd85 commit f0ba9b4

31 files changed

Lines changed: 70 additions & 173 deletions

‎.formatter.exs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Used by "mix format"
22
[
3+
line_length: 119,
34
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
45
locals_without_parens: [
56
# Hawk.Model

‎lib/hawk/json_api_controller_case.ex‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,7 @@ defmodule Hawk.JsonApiControllerCase do
497497
:ok
498498

499499
{:error, changeset} ->
500-
ExUnit.Assertions.flunk(
501-
"failed to insert JSON:API controller sample: #{inspect(changeset)}"
502-
)
500+
ExUnit.Assertions.flunk("failed to insert JSON:API controller sample: #{inspect(changeset)}")
503501
end
504502
end
505503

‎lib/hawk/model.ex‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ defmodule Hawk.Model do
9595
end
9696

9797
defp rewrite_expressions(expressions, caller) do
98-
Enum.map_reduce(expressions, %{policies: [], readers: [], json_api: nil}, fn expression,
99-
metadata ->
98+
Enum.map_reduce(expressions, %{policies: [], readers: [], json_api: nil}, fn expression, metadata ->
10099
rewrite_expression(expression, metadata, caller)
101100
end)
102101
end

‎lib/hawk/mutation_context.ex‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ defmodule Hawk.MutationContext do
145145
end
146146

147147
defp default_authorization_error(%__MODULE__{} = context) do
148-
Error.not_authorized(
149-
"You are not allowed to #{context.operation} this #{resource_name(context.model)}."
150-
)
148+
Error.not_authorized("You are not allowed to #{context.operation} this #{resource_name(context.model)}.")
151149
end
152150

153151
defp resource_name(%module{}) do

‎lib/hawk/open_api.ex‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ defmodule Hawk.OpenApi do
105105
do: write_operation(resource, :creatable, "Create #{resource_name(resource)}", 201)
106106

107107
defp route_operation(resource, %{action: :update}) do
108-
write_operation(resource, :updatable, "Update #{resource_name(resource)}", 200,
109-
parameters: [id_parameter()]
110-
)
108+
write_operation(resource, :updatable, "Update #{resource_name(resource)}", 200, parameters: [id_parameter()])
111109
end
112110

113111
defp route_operation(resource, %{action: :delete}), do: delete_operation(resource)
@@ -265,8 +263,7 @@ defmodule Hawk.OpenApi do
265263

266264
defp responses(_resource, success_status, success_schema) do
267265
%{
268-
Integer.to_string(success_status) =>
269-
json_api_content(success_description(success_status), success_schema),
266+
Integer.to_string(success_status) => json_api_content(success_description(success_status), success_schema),
270267
"400" => json_api_content("Invalid JSON:API query parameters", error_document_schema()),
271268
"403" => json_api_content("Forbidden by Hawk policy", error_document_schema()),
272269
"404" => json_api_content("Resource not found", error_document_schema()),

‎lib/hawk/policy.ex‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ defmodule Hawk.Policy do
3838
filter = opts |> Keyword.get(:filter, %{}) |> literal_option!(__CALLER__)
3939

4040
quote do
41-
@hawk_policy_read_roles {unquote(role),
42-
{:scoped, unquote(scopes), unquote(Macro.escape(filter))}}
41+
@hawk_policy_read_roles {unquote(role), {:scoped, unquote(scopes), unquote(Macro.escape(filter))}}
4342
end
4443
end
4544

‎lib/hawk/reader/resource.ex‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ defmodule Hawk.Reader.Resource do
9494
rewritten_block = rewrite_query_var(block, query_var)
9595

9696
quote do
97-
@hawk_reader_join_rules {unquote(name), unquote(when_filter), unquote(when_sort),
98-
unquote(handler_name)}
97+
@hawk_reader_join_rules {unquote(name), unquote(when_filter), unquote(when_sort), unquote(handler_name)}
9998

10099
defp unquote(handler_name)(unquote(query_var)) do
101100
unquote(rewritten_block)

‎test/hawk/controller_boundary_paths_test.exs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ defmodule Hawk.ControllerBoundaryPathsTest do
158158
status: "404",
159159
code: "action_not_found",
160160
title: "Not found",
161-
detail:
162-
"open-registration is not a supported action for missing_handler_resource"
161+
detail: "open-registration is not a supported action for missing_handler_resource"
163162
}
164163
]
165164
}
@@ -168,10 +167,7 @@ defmodule Hawk.ControllerBoundaryPathsTest do
168167
defp conn do
169168
%{
170169
assigns: %{
171-
authority:
172-
Hawk.Authority.new(:school_admin, Videdal.school_admin_id(),
173-
scopes: %{school_id: @school_id}
174-
)
170+
authority: Hawk.Authority.new(:school_admin, Videdal.school_admin_id(), scopes: %{school_id: @school_id})
175171
},
176172
status: nil,
177173
resp_body: nil

‎test/hawk/error_test.exs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ defmodule Hawk.ErrorTest do
6666

6767
test "invalid results convert to JSON:API source pointers" do
6868
authority =
69-
Authority.new(:teacher, @teacher_id,
70-
scopes: %{school_id: @school_id, teacher_id: @teacher_id}
71-
)
69+
Authority.new(:teacher, @teacher_id, scopes: %{school_id: @school_id, teacher_id: @teacher_id})
7270

7371
result =
7472
Grades.create(%{score: 12, school_id: @school_id, student_id: @student_id}, authority)
@@ -82,9 +80,7 @@ defmodule Hawk.ErrorTest do
8280

8381
test "invalid results convert to LiveView-friendly errors" do
8482
authority =
85-
Authority.new(:teacher, @teacher_id,
86-
scopes: %{school_id: @school_id, teacher_id: @teacher_id}
87-
)
83+
Authority.new(:teacher, @teacher_id, scopes: %{school_id: @school_id, teacher_id: @teacher_id})
8884

8985
result =
9086
Grades.create(%{score: 12, school_id: @school_id, student_id: @student_id}, authority)

‎test/hawk/filter_test.exs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ defmodule Hawk.FilterTest do
6262

6363
test "preserves non-map boolean structure" do
6464
assert Filter.and({:or, %{teacher_id: 1}, %{teacher_id: 2}}, %{active: true}) ==
65-
{:and, {:or, %{teacher_id: {:eq, 1}}, %{teacher_id: {:eq, 2}}},
66-
%{active: {:eq, true}}}
65+
{:and, {:or, %{teacher_id: {:eq, 1}}, %{teacher_id: {:eq, 2}}}, %{active: {:eq, true}}}
6766
end
6867
end
6968

@@ -84,8 +83,7 @@ defmodule Hawk.FilterTest do
8483
describe "keys/1" do
8584
test "extracts keys recursively through boolean nodes" do
8685
filter =
87-
{:and, %{school_id: 1, active: true},
88-
{:or, %{teacher_id: 2}, {:and, %{course_id: 3}, :none}}}
86+
{:and, %{school_id: 1, active: true}, {:or, %{teacher_id: 2}, {:and, %{course_id: 3}, :none}}}
8987

9088
assert Filter.keys(filter) == MapSet.new([:school_id, :active, :teacher_id, :course_id])
9189
end

0 commit comments

Comments
 (0)