Sha256: 77d39a696ae0339126f4bdc83e9fc9a99a6cb6cbe7ede996d15a08b2bc7cdd06

Contents?: true

Size: 866 Bytes

Versions: 3

Compression:

Stored size: 866 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

3 entries across 3 versions & 1 rubygems

Version Path
reek-5.0.2 lib/reek/smell_detectors/irresponsible_module.rb
reek-5.0.1 lib/reek/smell_detectors/irresponsible_module.rb
reek-5.0.0 lib/reek/smell_detectors/irresponsible_module.rb