Sha256: ef9815205f5057cf9261d02a4d646a5b0455328781330641f35485215cd82c0a
Contents?: true
Size: 926 Bytes
Versions: 4
Compression:
Stored size: 926 Bytes
Contents
# frozen_string_literal: true require_relative 'base_detector' module Reek module SmellDetectors # # 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 < BaseDetector def self.contexts # :nodoc: [:module] end # # Checks whether module has method 'initialize'. # # @return [Array<SmellWarning>] # # :reek:FeatureEnvy def sniff(ctx) ctx.local_nodes(:def) do |node| if node.name == :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