Sha256: 796e3aeecf1da2c8802249cd5ac0edee65b7c623448b171e0eeb3967849f3257
Contents?: true
Size: 1.15 KB
Versions: 11
Compression:
Stored size: 1.15 KB
Contents
module RuboCop::Git # ref. https://github.com/thoughtbot/hound/blob/d2f3933/app/models/style_checker.rb class StyleChecker def initialize(modified_files, rubocop_options, config_file, custom_config = nil) @modified_files = modified_files @rubocop_options = rubocop_options @config_file = config_file @custom_config = custom_config end def violations file_violations = @modified_files.map do |modified_file| FileViolation.new(modified_file.filename, offenses(modified_file)) end file_violations.select do |file_violation| file_violation.offenses.any? end end private def offenses(modified_file) violations = style_guide.violations(modified_file) violations_on_changed_lines(modified_file, violations) end def violations_on_changed_lines(modified_file, violations) violations.select do |violation| modified_file.relevant_line?(violation.line) end end def style_guide @style_guide ||= StyleGuide.new(@rubocop_options, @config_file, @custom_config) end end end
Version data entries
11 entries across 11 versions & 2 rubygems