class RuboCop::CachedData

def deserialize_offenses(offenses)

Restore an offense object loaded from a JSON file.
def deserialize_offenses(offenses)
  source_buffer = Parser::Source::Buffer.new(@filename)
  source_buffer.source = File.read(@filename, encoding: Encoding::UTF_8)
  offenses.map! do |o|
    location = Parser::Source::Range.new(source_buffer,
                                         o['location']['begin_pos'],
                                         o['location']['end_pos'])
    Cop::Offense.new(o['severity'], location, o['message'], o['cop_name'], o['status'].to_sym)
  end
end