Skip to content

Commit

Permalink
Update the documentation for `Lint/BinaryOperatorWithIdenticalOperand…
Browse files Browse the repository at this point in the history
…s` to mention the operators that are ignored.
  • Loading branch information
dvandersluis authored and mergify[bot] committed Sep 15, 2021
1 parent 80c9feb commit 5402b1a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb
Expand Up @@ -5,12 +5,18 @@ module Cop
module Lint
# This cop checks for places where binary operator has identical operands.
#
# It covers arithmetic operators: `+`, `-`, `*`, `/`, `%`, `**`;
# It covers arithmetic operators: `-`, `/`, `%`;
# comparison operators: `==`, `===`, `=~`, `>`, `>=`, `<`, `<=`;
# bitwise operators: `|`, `^`, `&`, `<<`, `>>`;
# bitwise operators: `|`, `^`, `&`;
# boolean operators: `&&`, `||`
# and "spaceship" operator - `<=>`.
#
# Simple arithmetic operations are allowed by this cop: `+`, `*`, `**`, `<<` and `>>`.
# Although these can be rewritten in a different way, it should not be necessary to
# do so. This does not include operations such as `-` or `/` where the result will
# always be the same (`x - x` will always be 0; `x / x` will always be 1), and
# thus are legitimate offenses.
#
# This cop is marked as unsafe as it does not consider side effects when calling methods
# and thus can generate false positives:
# if wr.take_char == '\0' && wr.take_char == '\0'
Expand Down

0 comments on commit 5402b1a

Please sign in to comment.