class Gemfilelint::Parser::Valid

Public Instance Methods

each_offense() { |dependency_offense_for(dependency)| ... } click to toggle source
# File lib/gemfilelint.rb, line 55
def each_offense
  dependencies.each do |dependency|
    yield dependency_offense_for(dependency)
  end

  remotes.each do |remote|
    yield remote_offense_for(remote)
  end
end

Private Instance Methods

dependencies() click to toggle source
# File lib/gemfilelint.rb, line 67
def dependencies
  dsl.dependencies.map(&:name)
end
dependency_offense_for(name) click to toggle source
# File lib/gemfilelint.rb, line 71
def dependency_offense_for(name)
  corrections = Gemfilelint.dependencies.correct(name)
  return if corrections.empty?

  Offenses::Dependency.new(path, name, corrections.first(5))
end
remote_offense_for(uri) click to toggle source
# File lib/gemfilelint.rb, line 88
def remote_offense_for(uri)
  corrections = Gemfilelint.remotes.correct(uri)
  return if corrections.empty?

  Offenses::Remote.new(path, uri, corrections)
end
remotes() click to toggle source

Lol wut, there has got to be a better way to do this

# File lib/gemfilelint.rb, line 79
def remotes
  sources = dsl.instance_variable_get(:@sources)
  rubygems =
    sources.instance_variable_get(:@rubygems_aggregate) ||
    sources.instance_variable_get(:@global_rubygems_source)

  rubygems.remotes.map(&:to_s)
end