Skip to content

Commit 7a1290c

Browse files
committed
'mix fmt' says it should be formatted this way, now
1 parent e03f2be commit 7a1290c

File tree

7 files changed

+73
-63
lines changed

7 files changed

+73
-63
lines changed

lib/matrix_client/client.ex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ defmodule M51.MatrixClient.Client do
147147

148148
%HTTPoison.Response{status_code: status_code} ->
149149
message =
150-
"Could not reach the Matrix homeserver for #{hostname}, #{url} returned HTTP #{
151-
status_code
152-
}. Make sure this is a Matrix homeserver and https://#{hostname}/.well-known/matrix/client is properly configured."
150+
"Could not reach the Matrix homeserver for #{hostname}, #{url} returned HTTP #{status_code}. Make sure this is a Matrix homeserver and https://#{hostname}/.well-known/matrix/client is properly configured."
153151

154152
{:reply, {:error, :unknown, message}, state}
155153
end
@@ -487,7 +485,6 @@ defmodule M51.MatrixClient.Client do
487485
)
488486

489487
base_url
490-
491488
end
492489
end
493490

lib/matrix_client/poller.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ defmodule M51.MatrixClient.Poller do
8989
delay =
9090
if delay do
9191
Logger.warn(
92-
"Server connection error [#{reconnect_reason}], retrying after #{round(delay/1000)}s"
92+
"Server connection error [#{reconnect_reason}], retrying after #{round(delay / 1000)}s"
9393
)
94+
9495
Process.sleep(delay)
9596
round(min(delay * @connect_delay_factor, @connect_delay_max))
9697
else

lib/matrix_client/sender.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ defmodule M51.MatrixClient.Sender do
5858

5959
raw_client ->
6060
path =
61-
"/_matrix/client/r0/rooms/#{urlquote(room_id)}/send/#{urlquote(event_type)}/#{
62-
urlquote(transaction_id)
63-
}"
61+
"/_matrix/client/r0/rooms/#{urlquote(room_id)}/send/#{urlquote(event_type)}/#{urlquote(transaction_id)}"
6462

6563
body = Jason.encode!(event)
6664

test/format/common_test.exs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,20 @@ defmodule M51.FormatTest do
120120
|> expect(:get, 4, fn url ->
121121
assert url == "https://example.org/.well-known/matrix/client"
122122

123-
{:ok, %HTTPoison.Response{
124-
status_code: 200,
125-
body: ~s({"m.homeserver": {"base_url": "https://api.example.org"}})
126-
}}
123+
{:ok,
124+
%HTTPoison.Response{
125+
status_code: 200,
126+
body: ~s({"m.homeserver": {"base_url": "https://api.example.org"}})
127+
}}
127128
end)
128129
|> expect(:get, 1, fn url ->
129130
assert url == "https://homeserver.org/.well-known/matrix/client"
130131

131-
{:ok, %HTTPoison.Response{
132-
status_code: 200,
133-
body: ~s({"m.homeserver": {"base_url": "https://api.homeserver.org"}})
134-
}}
132+
{:ok,
133+
%HTTPoison.Response{
134+
status_code: 200,
135+
body: ~s({"m.homeserver": {"base_url": "https://api.homeserver.org"}})
136+
}}
135137
end)
136138

137139
assert M51.Format.matrix2irc(~s(<a href="https://example.org">foo</a>)) ==
@@ -181,10 +183,11 @@ defmodule M51.FormatTest do
181183
|> expect(:get, 1, fn url ->
182184
assert url == "https://example.org/.well-known/matrix/client"
183185

184-
{:ok, %HTTPoison.Response{
185-
status_code: 404,
186-
body: ~s(this is not JSON)
187-
}}
186+
{:ok,
187+
%HTTPoison.Response{
188+
status_code: 404,
189+
body: ~s(this is not JSON)
190+
}}
188191
end)
189192

190193
assert M51.Format.matrix2irc(~s(<img src="mxc://example.org/foo" />)) ==
@@ -200,8 +203,10 @@ defmodule M51.FormatTest do
200203

201204
# can log "failed with connection error [connrefused]" warning
202205
Logger.remove_backend(:console)
206+
203207
assert M51.Format.matrix2irc(~s(<img src="mxc://example.org/foo" />)) ==
204208
"https://example.org/_matrix/media/r0/download/example.org/foo"
209+
205210
Logger.add_backend(:console)
206211
end
207212

test/irc/handler_test.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ defmodule M51.IrcConn.HandlerTest do
200200
send(handler, cmd("USER ident * * :My GECOS"))
201201

202202
# foo:example.org\x00foo:example.org\x00correct password
203-
send(handler, cmd("AUTHENTICATE PLAIN Zm9vOmV4YW1wbGUub3JnAGZvbzpleGFtcGxlLm9yZwBjb3JyZWN0IHBhc3N3b3Jk")
203+
send(
204+
handler,
205+
cmd("AUTHENTICATE PLAIN Zm9vOmV4YW1wbGUub3JnAGZvbzpleGFtcGxlLm9yZwBjb3JyZWN0IHBhc3N3b3Jk")
204206
)
205207

206208
assert_line(

test/matrix_client/client_test.exs

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ defmodule M51.MatrixClient.ClientTest do
8484
|> expect(:get, fn url ->
8585
assert url == "https://example.org/.well-known/matrix/client"
8686

87-
{:ok, %HTTPoison.Response{
88-
status_code: 404,
89-
body: """
90-
Error 404
91-
"""
92-
}}
87+
{:ok,
88+
%HTTPoison.Response{
89+
status_code: 404,
90+
body: """
91+
Error 404
92+
"""
93+
}}
9394
end)
9495
|> expect(:get!, fn url ->
9596
assert url == "https://example.org/_matrix/client/r0/login"
@@ -122,12 +123,13 @@ defmodule M51.MatrixClient.ClientTest do
122123
|> expect(:get, fn url ->
123124
assert url == "https://matrix.example.org/.well-known/matrix/client"
124125

125-
{:ok, %HTTPoison.Response{
126-
status_code: 404,
127-
body: """
128-
Error 404
129-
"""
130-
}}
126+
{:ok,
127+
%HTTPoison.Response{
128+
status_code: 404,
129+
body: """
130+
Error 404
131+
"""
132+
}}
131133
end)
132134
|> expect(:get!, fn url ->
133135
assert url == "https://matrix.example.org/_matrix/client/r0/login"
@@ -193,16 +195,17 @@ defmodule M51.MatrixClient.ClientTest do
193195
test "connection with well-known", %{sup_pid: sup_pid} do
194196
MockHTTPoison
195197
|> expect(:get, fn _url ->
196-
{:ok, %HTTPoison.Response{
197-
status_code: 200,
198-
body: """
199-
{
200-
"m.homeserver": {
201-
"base_url": "https://matrix.example.com"
202-
}
203-
}
204-
"""
205-
}}
198+
{:ok,
199+
%HTTPoison.Response{
200+
status_code: 200,
201+
body: """
202+
{
203+
"m.homeserver": {
204+
"base_url": "https://matrix.example.com"
205+
}
206+
}
207+
"""
208+
}}
206209
end)
207210
|> expect(:get!, fn url ->
208211
assert url == "https://matrix.example.com/_matrix/client/r0/login"
@@ -273,12 +276,13 @@ defmodule M51.MatrixClient.ClientTest do
273276
|> expect(:get, fn url ->
274277
assert url == "https://matrix.example.org/.well-known/matrix/client"
275278

276-
{:ok, %HTTPoison.Response{
277-
status_code: 404,
278-
body: """
279-
Error 404
280-
"""
281-
}}
279+
{:ok,
280+
%HTTPoison.Response{
281+
status_code: 404,
282+
body: """
283+
Error 404
284+
"""
285+
}}
282286
end)
283287
|> expect(:get!, fn url ->
284288
assert url == "https://matrix.example.org/_matrix/client/r0/login"
@@ -317,12 +321,13 @@ defmodule M51.MatrixClient.ClientTest do
317321
|> expect(:get, fn url ->
318322
assert url == "https://matrix.example.org/.well-known/matrix/client"
319323

320-
{:ok, %HTTPoison.Response{
321-
status_code: 404,
322-
body: """
323-
Error 404
324-
"""
325-
}}
324+
{:ok,
325+
%HTTPoison.Response{
326+
status_code: 404,
327+
body: """
328+
Error 404
329+
"""
330+
}}
326331
end)
327332
|> expect(:get!, fn url ->
328333
assert url == "https://matrix.example.org/_matrix/client/r0/login"

test/matrix_client/poller_test.exs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,20 +1149,22 @@ defmodule M51.MatrixClient.PollerTest do
11491149
|> expect(:get, 0, fn url ->
11501150
assert url == "https://matrix.org/.well-known/matrix/client"
11511151

1152-
{:ok, %HTTPoison.Response{
1153-
status_code: 200,
1154-
body: ~s({"m.homeserver": {"base_url": "https://matrix-client.matrix.org"}})
1155-
}}
1152+
{:ok,
1153+
%HTTPoison.Response{
1154+
status_code: 200,
1155+
body: ~s({"m.homeserver": {"base_url": "https://matrix-client.matrix.org"}})
1156+
}}
11561157
end)
11571158
else
11581159
MockHTTPoison
11591160
|> expect(:get, 5, fn url ->
11601161
assert url == "https://matrix.org/.well-known/matrix/client"
11611162

1162-
{:ok, %HTTPoison.Response{
1163-
status_code: 200,
1164-
body: ~s({"m.homeserver": {"base_url": "https://matrix-client.matrix.org"}})
1165-
}}
1163+
{:ok,
1164+
%HTTPoison.Response{
1165+
status_code: 200,
1166+
body: ~s({"m.homeserver": {"base_url": "https://matrix-client.matrix.org"}})
1167+
}}
11661168
end)
11671169
end
11681170

0 commit comments

Comments
 (0)