Sha256: 1575e3e21b128fb9e2e60b80b55f74d6f57c78adecfb96be4fdd40f9d505e2dc

Contents?: true

Size: 737 Bytes

Versions: 27

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_detector'

module Reek
  module SmellDetectors
    #
    # Methods should use their parameters.
    #
    # See {file:docs/Unused-Parameters.md} for details.
    class UnusedParameters < BaseDetector
      #
      # Checks whether the given method has any unused parameters.
      #
      # @return [Array<SmellWarning>]
      #
      def sniff
        return [] if context.uses_super_with_implicit_arguments?

        context.unused_params.map do |param|
          name = param.name.to_s
          smell_warning(
            lines: [source_line],
            message: "has unused parameter '#{name}'",
            parameters: { name: name })
        end
      end
    end
  end
end

Version data entries

27 entries across 25 versions & 2 rubygems

Version Path
reek-6.3.0 lib/reek/smell_detectors/unused_parameters.rb
reek-6.2.0 lib/reek/smell_detectors/unused_parameters.rb
reek-6.1.4 lib/reek/smell_detectors/unused_parameters.rb
reek-6.1.3 lib/reek/smell_detectors/unused_parameters.rb
reek-6.1.2 lib/reek/smell_detectors/unused_parameters.rb
reek-6.1.1 lib/reek/smell_detectors/unused_parameters.rb
reek-6.1.0 lib/reek/smell_detectors/unused_parameters.rb
reek-6.0.6 lib/reek/smell_detectors/unused_parameters.rb
reek-6.0.5 lib/reek/smell_detectors/unused_parameters.rb
reek-6.0.4 lib/reek/smell_detectors/unused_parameters.rb
reek-6.0.3 lib/reek/smell_detectors/unused_parameters.rb
reek-6.0.2 lib/reek/smell_detectors/unused_parameters.rb
reek-6.0.1 lib/reek/smell_detectors/unused_parameters.rb
reek-6.0.0 lib/reek/smell_detectors/unused_parameters.rb
reek-5.6.0 lib/reek/smell_detectors/unused_parameters.rb
reek-5.5.0 lib/reek/smell_detectors/unused_parameters.rb
reek-5.4.1 lib/reek/smell_detectors/unused_parameters.rb
reek-5.4.0 lib/reek/smell_detectors/unused_parameters.rb
reek-5.3.2 lib/reek/smell_detectors/unused_parameters.rb
reek-5.3.1 lib/reek/smell_detectors/unused_parameters.rb