class Reek::CodeClimate::CodeClimateFingerprint
Generates a string to uniquely identify a smell
Constants
- NON_IDENTIFYING_PARAMETERS
Attributes
Public Class Methods
Source
# File lib/reek/code_climate/code_climate_fingerprint.rb, line 11 def initialize(warning) @warning = warning end
Public Instance Methods
Source
# File lib/reek/code_climate/code_climate_fingerprint.rb, line 15 def compute return unless warning_uniquely_identifiable? identify_warning identifying_aspects.hexdigest.freeze end
Private Instance Methods
Source
# File lib/reek/code_climate/code_climate_fingerprint.rb, line 27 def identify_warning identifying_aspects << warning.source identifying_aspects << warning.smell_type identifying_aspects << warning.context identifying_aspects << parameters end
Source
# File lib/reek/code_climate/code_climate_fingerprint.rb, line 34 def identifying_aspects @identifying_aspects ||= Digest::MD5.new end
Source
# File lib/reek/code_climate/code_climate_fingerprint.rb, line 38 def parameters warning.parameters.except(*NON_IDENTIFYING_PARAMETERS).sort.to_s end
Source
# File lib/reek/code_climate/code_climate_fingerprint.rb, line 42 def warning_uniquely_identifiable? # These could be identifiable if they had parameters ![ 'ManualDispatch', 'NilCheck' ].include?(warning.smell_type) end