require_relative './file_reviewer.rb' module Checkstyle class Reviewer attr_reader :repository, :report_file_path, :syntax_violation_report def initialize(repository, report_file_path) @report_file_path = report_file_path @syntax_violation_report = JSON.parse(File.open(report_file_path).read).fetch('files', []) @repository = repository end def review log "Reviewing based on #{report_file_path}" syntax_violation_report.each do |file_report| next if file_report.fetch('offenses', []).empty? review_file(file_report) end end private def review_file(file_report) path = file_report.fetch('path', "") violations = file_report.fetch('offenses', []) FileReviewer.new(repository, path, violations).review end def log(text) puts "[CHECKSTYLE][Review] #{text}" end end end