mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
Merge pull request #311 from philomena-dev/credo-efficiency
Fix some credo issues
This commit is contained in:
commit
8df91eff16
7 changed files with 16 additions and 14 deletions
11
.credo.exs
Normal file
11
.credo.exs
Normal file
|
@ -0,0 +1,11 @@
|
|||
%{
|
||||
configs: %{
|
||||
name: "default",
|
||||
checks: %{
|
||||
disabled: [
|
||||
{Credo.Check.Refactor.CondStatements, false},
|
||||
{Credo.Check.Refactor.NegatedConditionsWithElse, false}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -333,7 +333,7 @@ defmodule Philomena.Galleries do
|
|||
end)
|
||||
|
||||
changes
|
||||
|> Enum.map(fn change ->
|
||||
|> Enum.each(fn change ->
|
||||
id = Keyword.fetch!(change, :id)
|
||||
change = Keyword.delete(change, :id)
|
||||
|
||||
|
|
|
@ -535,7 +535,6 @@ defmodule Philomena.Users.User do
|
|||
"data:image/png;base64," <> png
|
||||
end
|
||||
|
||||
@spec totp_secret(%Philomena.Users.User{}) :: binary()
|
||||
def totp_secret(user) do
|
||||
Philomena.Users.Encryptor.decrypt_model(
|
||||
user.encrypted_otp_secret,
|
||||
|
|
|
@ -212,9 +212,7 @@ defmodule PhilomenaQuery.Parse.Parser do
|
|||
end
|
||||
|
||||
defp debug_tokens(tokens) do
|
||||
tokens
|
||||
|> Enum.map(fn {_k, v} -> v end)
|
||||
|> Enum.join("")
|
||||
Enum.map_join(tokens, fn {_k, v} -> v end)
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -26,7 +26,6 @@ defmodule PhilomenaQuery.Parse.String do
|
|||
str
|
||||
|> String.replace("\r", "")
|
||||
|> String.split("\n", trim: true)
|
||||
|> Enum.map(fn s -> "(#{s})" end)
|
||||
|> Enum.join(" || ")
|
||||
|> Enum.map_join(" || ", &"(#{&1})")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,10 +37,7 @@ defmodule PhilomenaWeb.ContentSecurityPolicyPlug do
|
|||
{:media_src, ["'self'", "blob:", "data:", cdn_uri, camo_uri]}
|
||||
]
|
||||
|
||||
csp_value =
|
||||
csp_config
|
||||
|> Enum.map(&cspify_element/1)
|
||||
|> Enum.join("; ")
|
||||
csp_value = Enum.map_join(csp_config, "; ", &cspify_element/1)
|
||||
|
||||
csp_relaxed? do
|
||||
if conn.status == 500 do
|
||||
|
|
|
@ -117,9 +117,7 @@ defmodule PhilomenaWeb.AppView do
|
|||
def escape_nl2br(text) do
|
||||
text
|
||||
|> String.split("\n")
|
||||
|> Enum.map(&html_escape/1)
|
||||
|> Enum.map(&safe_to_string/1)
|
||||
|> Enum.join("<br/>")
|
||||
|> Enum.map_intersperse("<br />", &safe_to_string(html_escape(&1)))
|
||||
|> raw()
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue