Sha256: 4e9d80999d8d95a04c5a8d5d62fb0a5efe979b273971a235febff00c05cddf72

Contents?: true

Size: 814 Bytes

Versions: 13

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true
require_relative 'smell_detector'
require_relative 'smell_warning'

module Reek
  module Smells
    #
    # Methods should use their parameters.
    #
    # See {file:docs/Unused-Parameters.md} for details.
    class UnusedParameters < SmellDetector
      #
      # Checks whether the given method has any unused parameters.
      #
      # @return [Array<SmellWarning>]
      #
      # :reek:FeatureEnvy
      def inspect(ctx)
        return [] if ctx.uses_super_with_implicit_arguments?
        ctx.unused_params.map do |param|
          name = param.name.to_s
          smell_warning(
            context: ctx,
            lines: [ctx.exp.line],
            message: "has unused parameter '#{name}'",
            parameters: { name: name })
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
reek-4.2.3 lib/reek/smells/unused_parameters.rb
reek-4.2.2 lib/reek/smells/unused_parameters.rb
reek-4.2.1 lib/reek/smells/unused_parameters.rb
reek-4.2.0 lib/reek/smells/unused_parameters.rb
reek-4.1.1 lib/reek/smells/unused_parameters.rb
reek-4.1.0 lib/reek/smells/unused_parameters.rb
reek-4.0.5 lib/reek/smells/unused_parameters.rb
reek-4.0.4 lib/reek/smells/unused_parameters.rb
reek-4.0.3 lib/reek/smells/unused_parameters.rb
reek-4.0.2 lib/reek/smells/unused_parameters.rb
reek-4.0.1 lib/reek/smells/unused_parameters.rb
reek-4.0.0 lib/reek/smells/unused_parameters.rb
reek-4.0.0.pre1 lib/reek/smells/unused_parameters.rb