Sha256: 5e2de136577bc357173a29eb512506ab5f8b6492f567d8e4ad1949f833f9df55
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module Rubocop module Cop # Prevents usage of the `git` and `github` arguments to `gem` in a # `Gemfile` in order to avoid additional points of failure beyond # rubygems.org. class GemFetcher < RuboCop::Cop::Base MSG = 'Do not use gems from git repositories, only use gems from RubyGems or vendored gems. ' \ 'See https://docs.gitlab.com/ee/development/gemfile.html#no-gems-fetched-from-git-repositories' # See https://bundler.io/guides/git.html#custom-git-sources GIT_SOURCES = %i[git github gist bitbucket].freeze # @!method gem_option(node) def_node_matcher :gem_option, <<~PATTERN (send nil? :gem _ ... (hash <$(pair (sym {#{GIT_SOURCES.map(&:inspect).join(' ')}}) _) ...> ) ) PATTERN RESTRICT_ON_SEND = %i[gem].freeze def on_send(node) pair_node = gem_option(node) return unless pair_node add_offense(pair_node) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gitlab-styles-11.0.0 | lib/rubocop/cop/gem_fetcher.rb |
gitlab-styles-10.1.0 | lib/rubocop/cop/gem_fetcher.rb |
gitlab-styles-10.0.0 | lib/rubocop/cop/gem_fetcher.rb |