class Gitlab::Styles::Rubocop::Cop::GemFetcher
This 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.
Constants
- GIT_KEYS
- MSG
Public Instance Methods
on_send(node)
click to toggle source
# File lib/gitlab/styles/rubocop/cop/gem_fetcher.rb, line 15 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(node, location: pair.source_range) if GIT_KEYS.include?(key_name) end end
Private Instance Methods
gemfile?(node)
click to toggle source
# File lib/gitlab/styles/rubocop/cop/gem_fetcher.rb, line 29 def gemfile?(node) node .location .expression .source_buffer .name .end_with?("Gemfile") end