Sha256: de3349ab56eab8859d607f96f9093b0d85a9037b91ae2ac7fd9098763f543436
Contents?: true
Size: 607 Bytes
Versions: 2
Compression:
Stored size: 607 Bytes
Contents
require 'comment' module Inputs class RubocopJson attr_accessor :filename def initialize(filename = 'rubocop.json') self.filename = filename fail "#{filename} does not exist" unless File.exist?(filename) end def comments report['files'].map do |file| file['offenses'].map do |offense| Comment.new( file: file['path'], line: offense['location']['line'], text: offense['message'] ) end end.flatten end private def report JSON.parse(File.read(filename)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stash_pull_request_commenter-0.0.2 | lib/stash_pull_request_commenter/inputs/rubocop_json.rb |
stash_pull_request_commenter-0.0.1 | lib/stash_pull_request_commenter/inputs/rubocop_json.rb |