Sha256: 33f83ad6480f95bbb28e24a5c7b4126a47d132728f23182f69adeaa89b80b528
Contents?: true
Size: 854 Bytes
Versions: 4
Compression:
Stored size: 854 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 examine_context(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
4 entries across 4 versions & 1 rubygems