Sha256: d402b6a5873ebbe449c676c59096e2ff386064ee35a45fc0aab774772a554b49
Contents?: true
Size: 622 Bytes
Versions: 2
Compression:
Stored size: 622 Bytes
Contents
require 'json' 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.2.1 | lib/stash_pull_request_commenter/inputs/rubocop_json.rb |
stash_pull_request_commenter-0.2.0 | lib/stash_pull_request_commenter/inputs/rubocop_json.rb |