Class: Gemfilelint::Parser::Valid

Inherits:
Struct
  • Object
show all
Defined in:
lib/gemfilelint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dslObject

Returns the value of attribute dsl

Returns:

  • (Object)

    the current value of dsl



52
53
54
# File 'lib/gemfilelint.rb', line 52

def dsl
  @dsl
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



52
53
54
# File 'lib/gemfilelint.rb', line 52

def path
  @path
end

Instance Method Details

#each_offense(ignore: []) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/gemfilelint.rb', line 53

def each_offense(ignore: [])
  dependencies.each do |name|
    next if ignore.include?(name)

    if (corrections = Gemfilelint.dependencies.correct(name)).any?
      yield Offenses::Dependency.new(path, name, corrections.first(5))
    else
      yield nil
    end
  end

  remotes.each do |uri|
    if (corrections = Gemfilelint.remotes.correct(uri)).any?
      yield Offenses::Remote.new(path, uri, corrections)
    else
      yield nil
    end
  end
end