Browse Source

fix credo warnings

merge-requests/8/head
Egor Kislitsyn 5 years ago
parent
commit
df6f5dcab6
2 changed files with 4 additions and 2 deletions
  1. +2
    -0
      lib/auto_linker/parser.ex
  2. +2
    -2
      test/auto_linker_test.exs

+ 2
- 0
lib/auto_linker/parser.ex View File

@ -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/^(?<tag>\#[[:word:]_]*[[:alpha:]_·][[:word:]_·]*)/u


+ 2
- 2
test/auto_linker_test.exs View File

@ -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) ==
"<a href=\"#\" class=\"phone-number\" data-phone=\"8888888888\">888 888-8888</a>" <>
" <a href='a.com' class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">ab</a>"
~s(<a href="#" class="phone-number" data-phone="8888888888">888 888-8888</a>) <>
~s( <a href='a.com' class="auto-linker" target="_blank" rel="noopener noreferrer">ab</a>)
end
test "all kinds of links" do


Loading…
Cancel
Save