class RubyCritic::RevisionComparator

Constants

SNAPSHOTS_DIR_NAME

Public Class Methods

new(paths) click to toggle source
# File lib/rubycritic/revision_comparator.rb, line 13
def initialize(paths)
  @paths = paths
end

Public Instance Methods

statuses=(analysed_modules_now) click to toggle source
# File lib/rubycritic/revision_comparator.rb, line 17
def statuses=(analysed_modules_now)
  return unless Config.source_control_system.revision?

  analysed_modules_before = load_cached_analysed_modules
  return unless analysed_modules_before

  SmellsStatusSetter.set(
    analysed_modules_before.flat_map(&:smells),
    analysed_modules_now.flat_map(&:smells)
  )
end

Private Instance Methods

load_cached_analysed_modules() click to toggle source
# File lib/rubycritic/revision_comparator.rb, line 31
def load_cached_analysed_modules
  Serializer.new(revision_file).load if File.file?(revision_file)
end
revision_file() click to toggle source
# File lib/rubycritic/revision_comparator.rb, line 35
def revision_file
  @revision_file ||= File.join(
    Config.root,
    SNAPSHOTS_DIR_NAME,
    VERSION,
    Digest::MD5.hexdigest(Marshal.dump(@paths)),
    Config.source_control_system.head_reference
  )
end