Sha256: 4087b8003d357cdda1e8bbe671332ba311f455ebbb1b1a4cc71940bf6856f45c
Contents?: true
Size: 996 Bytes
Versions: 13
Compression:
Stored size: 996 Bytes
Contents
# frozen_string_literal: true 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 inspect(ctx) ctx.local_nodes(:def) do |node| 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
13 entries across 13 versions & 1 rubygems