lib/base/code_issue.rb in metric_fu-2.0.0 vs lib/base/code_issue.rb in metric_fu-2.0.1

- old
+ new

@@ -17,21 +17,21 @@ end class CodeIssue < DelegateClass(Record) #DelegateClass(Ruport::Data::Record) include Comparable - # TODO: Yuck! 'stat_value' is a column for StatAnalyzer + # TODO: Yuck! 'stat_value' is a column for StatAnalyzer EXCLUDED_COLUMNS = FlogAnalyzer::COLUMNS + SaikuroAnalyzer::COLUMNS + ['stat_value'] + ChurnAnalyzer::COLUMNS + ReekAnalyzer.new.columns.extend(CarefulArray).carefully_remove(['reek__type_name', 'reek__comparable_message']) + FlayAnalyzer.new.columns.extend(CarefulArray).carefully_remove(['flay_matching_reason']) def <=>(other) spaceship_for_columns(self.attributes, other) end - + def ===(other) self.hash_for(included_columns_hash, included_columns) == other.hash_for(included_columns_hash, included_columns) end - + def spaceship_for_columns(columns, other) columns.each do |column| equality = self[column].to_s <=> other[column].to_s return equality if equality!=0 end @@ -39,11 +39,11 @@ end def hash_for(column_hash, columns) @hashes ||= {} # fetch would be cleaner, but slower - if @hashes.has_key?(column_hash) + if @hashes.has_key?(column_hash) @hashes[column_hash] else values = columns.map {|column| self[column]} hash_for_columns = values.join('').hash @hashes[column_hash]=hash_for_columns @@ -52,11 +52,11 @@ end def included_columns_hash @included_columns_hash ||= included_columns.hash end - + def included_columns @included_columns ||= self.attributes.extend(CarefulArray).carefully_remove(EXCLUDED_COLUMNS) end def find_counterpart_index_in(collection) @@ -76,14 +76,14 @@ #return false unless ["Large Class", "Long Method", "Long Parameter List"].include?(self.reek__type_name) return false if self.reek__type_name != other.reek__type_name self.reek__value != other.reek__value when :flog self.score != other.score - when :saikuro + when :saikuro self.complexity != other.complexity when :stats - self.stat_value != other.stat_value + self.stat_value != other.stat_value when :churn self.times_changed != other.times_changed when :flay #self.flay_reason != other.flay_reason # do nothing for now @@ -91,7 +91,7 @@ # do nothing else raise ArgumentError, "Invalid metric type #{self.metric}" end end - + end