Class: RuboCop::Cop::Homebrew::PublicApiCookbook Private

Inherits:
Base
  • Object
show all
Defined in:
rubocops/public_api_cookbook.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 and DSL calls documented in the Formula Cookbook or Cask Cookbook are annotated with @api public in their source definitions.

Both cookbook method lists live in ApiAnnotationHelper and are validated by .github/check_cookbook_method_lists.rb in CI.

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.

"Method `%<method>s` is referenced in the %<cookbook>s but is not annotated with `@api public`."

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.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'rubocops/public_api_cookbook.rb', line 19

def on_new_investigation
  super

  file_path = processed_source.file_path
  return if file_path.nil?

  relative_path = file_path.sub(%r{.*/Library/Homebrew/}, "")
  api_public_targets = build_api_public_targets

  check_cookbook_methods(ApiAnnotationHelper::FORMULA_COOKBOOK_METHODS,
                         "Formula Cookbook", relative_path, api_public_targets)
  check_cookbook_methods(ApiAnnotationHelper::CASK_COOKBOOK_METHODS,
                         "Cask Cookbook", relative_path, api_public_targets)
end