Sha256: a190219049d83c5a9515db6b28de5d0e45c16d56b12b43c67ecc551b97598c94
Contents?: true
Size: 882 Bytes
Versions: 31
Compression:
Stored size: 882 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>] # def sniff context.defined_instance_methods.each do |node| if node.name == :initialize return smell_warning( lines: [source_line], message: 'has initialize method') end end [] end end end end
Version data entries
31 entries across 29 versions & 2 rubygems