Sha256: 5d70c55308b5bb29c09f3680a346b39baa00ee691f62c6a3047412d0621902e2

Contents?: true

Size: 894 Bytes

Versions: 4

Compression:

Stored size: 894 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(
          context: context,
          lines: [source_line],
          message: 'has no descriptive comment')]
      end

      private

      def descriptive_context?
        context.descriptively_commented?
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reek-4.8.2 lib/reek/smell_detectors/irresponsible_module.rb
reek-4.8.1 lib/reek/smell_detectors/irresponsible_module.rb
reek-4.8.0 lib/reek/smell_detectors/irresponsible_module.rb
reek-4.7.3 lib/reek/smell_detectors/irresponsible_module.rb