Sha256: 18a989151cf8fcc6dd05c6cc03a024338350ea5d384ee3da9f7f1cb657edf34d
Contents?: true
Size: 812 Bytes
Versions: 6
Compression:
Stored size: 812 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 sniff(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
6 entries across 6 versions & 1 rubygems