Sha256: b9474a55827551f1dbd326b4385f0b342cf68cad1b6e2566626927248deb8615
Contents?: true
Size: 900 Bytes
Versions: 1
Compression:
Stored size: 900 Bytes
Contents
require 'json' require 'face_control/comment' module FaceControl module Inputs class RubocopJson attr_accessor :ignored_severities, :filename def initialize(ignored_severities = [], filename = 'rubocop.json') self.ignored_severities = ignored_severities self.filename = filename fail "#{filename} does not exist" unless File.exist?(filename) end def comments report['files'].map do |file| file['offenses'].reject do |offense| ignored_severities.include?(offense['severity']) end.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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
face_control-0.3.0 | lib/face_control/inputs/rubocop_json.rb |