1# frozen_string_literal: true
2
3module Gitlab
4  module DependencyLinker
5    class RequirementsTxtLinker < BaseLinker
6      self.file_type = :requirements_txt
7
8      private
9
10      def link_dependencies
11        link_regex(/^(?<name>(?![a-z+]+:)[^#.-][^ ><=~!;\[]+)/) do |name|
12          "https://pypi.python.org/pypi/#{name}"
13        end
14
15        link_regex(%r{^(?<name>https?://[^ ]+)}, &:itself)
16      end
17    end
18  end
19end
20