Don't match tilde and exclamation mark as part of requirements.txt package name

This commit is contained in:
Douwe Maan 2017-06-23 13:07:29 -05:00
parent 5cd1a48d5e
commit 11e22835ed
3 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
title: Don't match tilde and exclamation mark as part of requirements.txt package
name
merge_request:
author:

View file

@ -6,7 +6,7 @@ module Gitlab
private
def link_dependencies
link_regex(/^(?<name>(?![a-z+]+:)[^#.-][^ ><=;\[]+)/) do |name|
link_regex(/^(?<name>(?![a-z+]+:)[^#.-][^ ><=~!;\[]+)/) do |name|
"https://pypi.python.org/pypi/#{name}"
end

View file

@ -54,6 +54,8 @@ describe Gitlab::DependencyLinker::RequirementsTxtLinker, lib: true do
Sphinx>=1.3
docutils>=0.7
markupsafe
pytest~=3.0
foop!=3.0
CONTENT
end
@ -78,6 +80,8 @@ describe Gitlab::DependencyLinker::RequirementsTxtLinker, lib: true do
expect(subject).to include(link('Sphinx', 'https://pypi.python.org/pypi/Sphinx'))
expect(subject).to include(link('docutils', 'https://pypi.python.org/pypi/docutils'))
expect(subject).to include(link('markupsafe', 'https://pypi.python.org/pypi/markupsafe'))
expect(subject).to include(link('pytest', 'https://pypi.python.org/pypi/pytest'))
expect(subject).to include(link('foop', 'https://pypi.python.org/pypi/foop'))
end
it 'links URLs' do