Sha256: 551bd43f58b8468a4912409b9a69b0884c6150affce1ba7b3447d54760b3ba7c
Contents?: true
Size: 1006 Bytes
Versions: 4
Compression:
Stored size: 1006 Bytes
Contents
require_relative 'smell_detector' require_relative 'smell_warning' module Reek module Smells # # a module is usually a mixin, so when initialize method is present it is # hard to tell initialization order and parameters so having 'initialize' # in a module is usually a bad idea # # See {file:docs/Module-Initialize.md} for details. class ModuleInitialize < SmellDetector def self.contexts # :nodoc: [:module] end # # Checks whether module has method 'initialize'. # # @return [Array<SmellWarning>] # # :reek:FeatureEnvy def examine_context(ctx) ctx.local_nodes(:def) do |node| # FIXME: also search for :defs? if node.name.to_s == 'initialize' return [ smell_warning( context: ctx, lines: [ctx.exp.line], message: 'has initialize method') ] end end [] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems