Class: RuboCop::Cop::Sevgi::Parentheses

Inherits:
Style::MethodCallWithArgsParentheses
  • Object
show all
Defined in:
lib/rubocop/cop/sevgi/parentheses.rb

Overview

Omits optional parentheses from bare DSL-shaped calls and capitalized Sevgi operations.

Ordinary Ruby calls with explicit receivers retain their normal style. The inherited RuboCop implementation still preserves parentheses where Ruby syntax or expression binding benefits from them.

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ void Also known as: on_csend

This method returns an undefined value.

Checks a method call when its shape belongs to the Sevgi drawing vocabulary.

Parameters:

  • node (RuboCop::AST::SendNode)

    method call



17
18
19
20
21
# File 'lib/rubocop/cop/sevgi/parentheses.rb', line 17

def on_send(node)
  return if node.method_name.end_with?("?")

  super if node.receiver.nil? || node.method_name.match?(/\A[A-Z]/)
end