Class: Homebrew::RubocopResults

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/cmd/style.rb

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ RubocopResults



142
143
144
145
146
147
148
149
150
# File 'Library/Homebrew/cmd/style.rb', line 142

def initialize(json)
   = json["metadata"]
  @file_offenses = {}
  json["files"].each do |f|
    next if f["offenses"].empty?
    file = File.realpath(f["path"])
    @file_offenses[file] = f["offenses"].map { |x| RubocopOffense.new(x) }
  end
end

Instance Method Details

#file_offenses(path) ⇒ Object



152
153
154
# File 'Library/Homebrew/cmd/style.rb', line 152

def file_offenses(path)
  @file_offenses[path.to_s]
end