Sha256: 92261a486aed5d214d2924a6b46d4aab3cf932c5d08c4a3410a602c0cfa9714d

Contents?: true

Size: 868 Bytes

Versions: 12

Compression:

Stored size: 868 Bytes

Contents

require 'reek/smells/smell_detector'
require 'reek/smell_warning'

module Reek
  module Smells
    #
    # Methods should use their parameters.
    #
    class UnusedParameters < SmellDetector
      def self.smell_category
        'UnusedCode'
      end

      #
      # Checks whether the given method has any unused parameters.
      #
      # @return [Array<SmellWarning>]
      #
      def examine_context(method_ctx)
        return [] if method_ctx.uses_super_with_implicit_arguments?
        method_ctx.unused_params.map do |param|
          SmellWarning.new(self,
                           context: method_ctx.full_name,
                           lines: [method_ctx.exp.line],
                           message: "has unused parameter '#{param.name}'",
                           parameters: { name: param.name.to_s })
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
reek-2.0.4 lib/reek/smells/unused_parameters.rb
reek-2.0.3 lib/reek/smells/unused_parameters.rb
reek-2.0.2 lib/reek/smells/unused_parameters.rb
reek-2.0.1 lib/reek/smells/unused_parameters.rb
reek-2.0.0 lib/reek/smells/unused_parameters.rb
reek-1.6.6 lib/reek/smells/unused_parameters.rb
reek-1.6.5 lib/reek/smells/unused_parameters.rb
reek-1.6.4 lib/reek/smells/unused_parameters.rb
reek-1.6.3 lib/reek/smells/unused_parameters.rb
reek-1.6.2 lib/reek/smells/unused_parameters.rb
reek-1.6.1 lib/reek/smells/unused_parameters.rb
reek-1.6.0 lib/reek/smells/unused_parameters.rb