Class: RuboCop::Cop::Yardoc::SeparateTagsBlocks

Inherits:
RuboCop::Cop::YardocBase show all
Extended by:
AutoCorrector
Includes:
RangeHelp
Defined in:
lib/rubocop/cop/yardoc/separate_tags_blocks.rb

Overview

Ensures there are blank comment lines between blocks of tags in documentation comments.

Examples:

# bad

# Title
# @param x [Integer] desc
# @param y [Integer] desc
# @return [void]
def my_method(x, y); end

# good

# Title
#
# @param x [Integer] desc
# @param y [Integer] desc
#
# @return [void]
def my_method(x, y); end

Constant Summary collapse

MSG =
'Add a blank comment line between different tag blocks.'
COMMENT_TEXT_RE =

Matches a comment line: captures the text after #. # with only trailing whitespace is a "blank comment line".

/\A#\s?(.*)\z/
TAG_RE =

Matches a YARD-style tag at the start of comment text.

/\A@(\w+)/

Instance Method Summary collapse

Instance Method Details

#on_def(node) ⇒ Object Also known as: on_defs

Executed for each method definition

Parameters:

  • node (RuboCop::AST::Node) —

    The AST node



44
45
46
47
48
49
50
# File 'lib/rubocop/cop/yardoc/separate_tags_blocks.rb', line 44

def on_def(node)
  return unless documented? node

  doc_comment_groups(node).each do |group|
    check_group(group)
  end
end