Improve CI
This commit is contained in:
parent
db3b14d0f7
commit
37c5c3bdd1
3 changed files with 15 additions and 5 deletions
|
@ -3,11 +3,13 @@ image: elixir:1.7.2
|
||||||
cache:
|
cache:
|
||||||
key: ${CI_COMMIT_REF_SLUG}
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
paths:
|
paths:
|
||||||
- deps
|
- deps
|
||||||
- _build
|
- _build
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- lint
|
- lint
|
||||||
- test
|
- test
|
||||||
|
- analysis
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- mix local.hex --force
|
- mix local.hex --force
|
||||||
|
@ -22,5 +24,11 @@ lint:
|
||||||
|
|
||||||
unit-testing:
|
unit-testing:
|
||||||
stage: test
|
stage: test
|
||||||
|
coverage: '/(\d+\.\d+\%) \| Total/'
|
||||||
script:
|
script:
|
||||||
- mix test --trace
|
- mix test --trace --cover
|
||||||
|
|
||||||
|
analysis:
|
||||||
|
stage: analysis
|
||||||
|
script:
|
||||||
|
- mix credo --strict
|
||||||
|
|
|
@ -39,9 +39,11 @@ defmodule AutoLinker.Parser do
|
||||||
|
|
||||||
# @user
|
# @user
|
||||||
# @user@example.com
|
# @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
|
@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
|
# 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_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
|
@match_hashtag ~r/^(?<tag>\#[[:word:]_]*[[:alpha:]_·][[:word:]_·]*)/u
|
||||||
|
|
|
@ -24,8 +24,8 @@ defmodule AutoLinkerTest do
|
||||||
|
|
||||||
test "phone number and markdown link" do
|
test "phone number and markdown link" do
|
||||||
assert AutoLinker.link("888 888-8888 [ab](a.com)", phone: true, markdown: true) ==
|
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>" <>
|
~s(<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='a.com' class="auto-linker" target="_blank" rel="noopener noreferrer">ab</a>)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "all kinds of links" do
|
test "all kinds of links" do
|
||||||
|
|
Reference in a new issue