Class: Rubocop::Cop::Style::Documentation

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/style/documentation.rb

Overview

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes or other other modules.

Constant Summary collapse

MSG =
'Missing top-level %s documentation comment.'

Constants inherited from Cop

Cop::OPERATOR_METHODS

Instance Attribute Summary

Attributes inherited from Cop

#config, #corrections, #offences, #processed_source

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, all, #autocorrect?, #convention, #cop_config, cop_name, #cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, #message, non_rails, rails?, style?, #support_autocorrect?, #warning

Constructor Details

This class inherits a constructor from Rubocop::Cop::Cop

Instance Method Details

#investigate(processed_source) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rubocop/cop/style/documentation.rb', line 13

def investigate(processed_source)
  ast = processed_source.ast
  return unless ast

  ast_with_comments = Parser::Source::Comment.associate(
    ast,
    processed_source.comments
  )

  check(ast, ast_with_comments)
end