Sha256: 26936fa3fff04b00ae9445f5cf31e16660484f8b7536ca8aa8d5bcbb9c73e134
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
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.' GIT_KEYS = [:git, :github].freeze def on_send(node) return unless gemfile?(node) func_name = node.children[1] return unless func_name == :gem node.children.last.each_node(:pair) do |pair| key_name = pair.children[0].children[0].to_sym add_offense(pair.source_range) if GIT_KEYS.include?(key_name) end end private def gemfile?(node) node .location .expression .source_buffer .name .end_with?("Gemfile") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gitlab-styles-9.1.0 | lib/rubocop/cop/gem_fetcher.rb |
gitlab-styles-9.0.0 | lib/rubocop/cop/gem_fetcher.rb |