Fix code readability issues

This commit is contained in:
miffigriffi
2019-09-22 16:26:23 +02:00
committed by Thomas Citharel
parent 20dfce5c83
commit aed824f1aa
81 changed files with 379 additions and 309 deletions

View File

@@ -1,15 +1,14 @@
defmodule Mobilizon.Service.EmailChecker do
@moduledoc """
Provides a function to test emails against a "not so bad" regex
Provides a function to test emails against a "not so bad" regex.
"""
# TODO: simplify me!
@email_regex ~r/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
@doc """
Returns whether the email is valid
Returns whether the email is valid.
"""
@spec valid?(String.t()) :: boolean()
def valid?(email) do
email =~ @email_regex
end
@spec valid?(String.t()) :: boolean
def valid?(email), do: email =~ @email_regex
end