Sha256: 2ce88d21f7e93c3fe21950ecf1067affddf9ac8f11a149daba0a461fbfc40d94
Contents?: true
Size: 846 Bytes
Versions: 13
Compression:
Stored size: 846 Bytes
Contents
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 def self.smell_category 'UnusedCode' end # # 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