Sha256: 34918420ecf540a36961d3dfbef439d0034d68975692fc7d991fbfc94287a55c

Contents?: true

Size: 867 Bytes

Versions: 28

Compression:

Stored size: 867 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_detector'

module Reek
  module SmellDetectors
    #
    # It is considered good practice to annotate every class and module
    # with a brief comment outlining its responsibilities.
    #
    # See {file:docs/Irresponsible-Module.md} for details.
    class IrresponsibleModule < BaseDetector
      def self.contexts
        [:casgn, :class, :module]
      end

      #
      # Checks the given class or module for a descriptive comment.
      #
      # @return [Array<SmellWarning>]
      #
      def sniff
        return [] if descriptive_context? || context.namespace_module?

        [smell_warning(
          lines: [source_line],
          message: 'has no descriptive comment')]
      end

      private

      def descriptive_context?
        context.descriptively_commented?
      end
    end
  end
end

Version data entries

28 entries across 26 versions & 2 rubygems

Version Path
reek-6.4.0 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.3.0 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.2.0 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.1.4 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.1.3 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.1.2 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.1.1 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.1.0 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.0.6 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.0.5 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.0.4 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.0.3 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.0.2 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.0.1 lib/reek/smell_detectors/irresponsible_module.rb
reek-6.0.0 lib/reek/smell_detectors/irresponsible_module.rb
reek-5.6.0 lib/reek/smell_detectors/irresponsible_module.rb
reek-5.5.0 lib/reek/smell_detectors/irresponsible_module.rb
reek-5.4.1 lib/reek/smell_detectors/irresponsible_module.rb
reek-5.4.0 lib/reek/smell_detectors/irresponsible_module.rb
reek-5.3.2 lib/reek/smell_detectors/irresponsible_module.rb