Sha256: 4fe2f32933dd36ee56a8da118b1df99aa422376433ebb3064d259a498433d260

Contents?: true

Size: 824 Bytes

Versions: 22

Compression:

Stored size: 824 Bytes

Contents

# frozen_string_literal: true

module Reek
  module SmellDetectors
    module ControlParameterHelpers
      #
      # Collects information about a single control parameter.
      #
      class Candidate
        #
        # @param parameter [Symbol] the parameter name
        # @param occurences [Array<Reek::AST::Node>] the occurences of the ControlParameter smell
        #   e.g. [s(:lvar, :bravo), s(:lvar, :bravo)]
        #
        def initialize(parameter, occurences)
          @parameter = parameter
          @occurences = occurences
        end

        def smells?
          occurences.any?
        end

        def lines
          occurences.map(&:line)
        end

        def name
          parameter.to_s
        end

        private

        attr_reader :occurences, :parameter
      end
    end
  end
end

Version data entries

22 entries across 20 versions & 2 rubygems

Version Path
reek-6.1.1 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.1.0 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.0.6 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.0.5 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.0.4 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.0.3 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.0.2 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.0.1 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-6.0.0 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-5.6.0 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-5.5.0 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-5.4.1 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-5.4.0 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-5.3.2 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-5.3.1 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
reek-5.3.0 lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/smell_detectors/control_parameter_helpers/candidate.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/lib/reek/smell_detectors/control_parameter_helpers/candidate.rb