Class: RuboCop::Cop::Modularization::RequireDocumentedPublicApis

Inherits:
Style::DocumentationMethod
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/rubocop/cop/modularization/require_documented_public_apis.rb

Instance Method Summary collapse

Instance Method Details

#check(node) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rubocop/cop/modularization/require_documented_public_apis.rb', line 15

def check(node)
  # This cop only applies for ruby files in `app/public`
  return if !processed_source.file_path.include?('app/public')
  return if non_public?(node) && !require_for_non_public_methods?

  left_sibling = node.left_sibling
  left_sibling_is_sig = left_sibling && (left_sibling.source.include?('sig do') || left_sibling.source.include?('sig {'))
  # Is there a better way to check if the left sibling is a sorbet signature? Probably!
  if left_sibling_is_sig
    return if documentation_comment?(node.left_sibling)
  elsif documentation_comment?(node)
    return
  end

  add_offense(node)
end

#support_autocorrect?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/rubocop/cop/modularization/require_documented_public_apis.rb', line 10

def support_autocorrect?
  false
end