Class: RuboCop::Cop::Homebrew::PublicApiDocumentation Private

Inherits:
Base
  • Object
show all
Defined in:
rubocops/public_api_documentation.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Ensures that methods/attributes annotated with @api public have proper YARD documentation beyond just the annotation itself. A bare # @api public with no preceding description is not sufficient for public API methods.

Example

# bad
# @api public
sig { returns(String) }
def foo; end

# good
# The name of this object.
#
# @api public
sig { returns(String) }
def foo; end

Constant Summary collapse

MSG =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

"`@api public` methods must have a descriptive YARD comment, not just the annotation."

Instance Method Summary collapse

Instance Method Details

#on_new_investigationvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.



31
32
33
34
35
36
37
38
39
# File 'rubocops/public_api_documentation.rb', line 31

def on_new_investigation
  super

  processed_source.comments.each do |comment|
    next unless api_public_comment?(comment)

    add_offense(comment) unless descriptive_comment_preceding?(comment)
  end
end