Sha256: aa9adcc37246ebf49188b221913707573c2107ef3489612f748b6446f8d809ba
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
class RuboCop::Git::StyleChecker # ref. https://github.com/thoughtbot/hound/blob/d2f3933/app/models/style_checker.rb 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| RuboCop::Git::FileViolation.new( modified_file.absolute_path, 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 ||= RuboCop::Git::StyleGuide.new( @rubocop_options, @config_file, @custom_config ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-git2-0.1.6 | lib/rubocop/git/style_checker.rb |
rubocop-git2-0.1.5 | lib/rubocop/git/style_checker.rb |