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.'

Instance Attribute Summary

Attributes inherited from Cop

#autocorrect, #debug, #disabled_lines, #offences

Instance Method Summary collapse

Methods inherited from Cop

#add_offence, #autocorrect_action, cop_name, cop_type, #do_autocorrect, #ignore_node, inherited, #initialize, lint?, #name, rails?, style?

Constructor Details

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

Instance Method Details

#inspect(source_buffer, source, tokens, ast, comments) ⇒ Object



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

def inspect(source_buffer, source, tokens, ast, comments)
  return unless ast

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

  check_classes(ast, ast_with_comments)
  check_modules(ast, ast_with_comments)
end