From df6f5dcab61dc74b87e535234a9470bbbb95873d Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Wed, 3 Apr 2019 14:57:06 +0700 Subject: [PATCH] fix credo warnings --- lib/auto_linker/parser.ex | 2 ++ test/auto_linker_test.exs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/auto_linker/parser.ex b/lib/auto_linker/parser.ex index c37f56c..3395b9c 100644 --- a/lib/auto_linker/parser.ex +++ b/lib/auto_linker/parser.ex @@ -39,9 +39,11 @@ defmodule AutoLinker.Parser do # @user # @user@example.com + # credo:disable-for-next-line @match_mention ~r/^@[a-zA-Z\d_-]+@[a-zA-Z0-9_-](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*|@[a-zA-Z\d_-]+/u # https://www.w3.org/TR/html5/forms.html#valid-e-mail-address + # credo:disable-for-next-line @match_email ~r/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/u @match_hashtag ~r/^(?\#[[:word:]_]*[[:alpha:]_·][[:word:]_·]*)/u diff --git a/test/auto_linker_test.exs b/test/auto_linker_test.exs index 9bd0719..6fce60e 100644 --- a/test/auto_linker_test.exs +++ b/test/auto_linker_test.exs @@ -24,8 +24,8 @@ defmodule AutoLinkerTest do test "phone number and markdown link" do assert AutoLinker.link("888 888-8888 [ab](a.com)", phone: true, markdown: true) == - "888 888-8888" <> - " ab" + ~s(888 888-8888) <> + ~s( ab) end test "all kinds of links" do