Skip to content

Files

Latest commit

 

History

History
33 lines (23 loc) · 734 Bytes

Lint-RequireParentheses.md

File metadata and controls

33 lines (23 loc) · 734 Bytes

Pattern: Missing parentheses in method call

Issue: -

Description

This rule checks for expressions where there is a call to a predicate method with at least one argument, where no parentheses are used around the parameter list, and a boolean operator, && or ||, is used in the last argument.

The idea behind warning for these constructs is that the user might be under the impression that the return value from the method call is an operand of &&/||.

Examples

# bad

if day.is? :tuesday && month == :jan
  ...
end
# good

if day.is?(:tuesday) && month == :jan

Further Reading