class Rubycritic::RevisionComparator
def compare
def compare SmellsStatusSetter.new(smelly_pathnames_before, smelly_pathnames_now).smelly_pathnames end
def initialize(paths, source_control_system)
def initialize(paths, source_control_system) @paths = paths @source_control_system = source_control_system end
def paths_of_tracked_files
def paths_of_tracked_files SourceLocator.new(["."]).paths end
def revision_file
def revision_file @revision_file ||= File.join(SNAPSHOTS_DIR, @source_control_system.head_reference) end
def smelly_pathnames(paths)
def smelly_pathnames(paths) smell_adapters = AnalysersRunner.new(paths).run SmellsAggregator.new(smell_adapters).smelly_pathnames end
def smelly_pathnames_before
def smelly_pathnames_before serializer = SmellyPathnamesSerializer.new(revision_file) if File.file?(revision_file) serializer.load else smelly_pathnames = nil @source_control_system.travel_to_head do smelly_pathnames = smelly_pathnames(paths_of_tracked_files) end serializer.dump(smelly_pathnames) smelly_pathnames end end
def smelly_pathnames_now
def smelly_pathnames_now smelly_pathnames(@paths) end