Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

(PUP-2950) rubocop - Style/AndOR enabled for the entire puppet #2900

Closed
wants to merge 38 commits into from

3 participants

@vrthra
Collaborator

The changes were partially automated by regular expression search and replace (about 400 out of 800 changes). The changes were further manually inspected to ensure that the changes were indeed sane.

@vrthra vrthra changed the title from (PUP-2950) rubocop - Style/AndOR enabled for the entire puppet to (PUP-2950) rubocop - Style/AndOR enabled for the entire puppet (NOT READY FOR MERGE)
@puppetcla

CLA signed by all contributors.

@vrthra vrthra changed the title from (PUP-2950) rubocop - Style/AndOR enabled for the entire puppet (NOT READY FOR MERGE) to (PUP-2950) rubocop - Style/AndOR enabled for the entire puppet
vrthra added some commits
@vrthra vrthra (PUP-2950) ensure that default layer is used when the user has not pr…
…ovided a layer

Without this patch,

```
      unless diagnostics.errors?
        @layering_config   = data['layers'] or default_layers
        @scheme_extensions = (data['extensions'] and
                  data['extensions']['scheme_handlers'] or
                  default_scheme_extensions)
      else
        @layering_config = []
        @scheme_extensions = {}
      end
```
This would have resulted in @layering_config not being assigned a value if no
layers was set. This is clearly not intented. This patch updates the behavior
so that `@layering_config` is assigned default_layers instead
(by changing `or` to `||`)

This commit also adds test cases to verify that this case is caught.
bcb3f73
@vrthra vrthra (PUP-2950) enabling rubocop Style/AndOr cop in pops directory
This commits enables `AndOr` cop only in lib/puppet/pops directory. This cop
bans the use of `and` and `or` keywords in favor of `&&` and `||`. We have
chosen this directory as a test case to evaluate the utility of enabling
`AndOr` on the complete codebase. We inherit from the base rubocop file, so all
the other cops remain enabled. At a future date, when `AndOr` is enabled
systemwide, this file may be removed (if no other specialization exists on pops
directory).

It changes all code that uses `and` and `or` keywords to use `&&` and
`||`  instead. Note that this commit only fixes the lib/puppet/pops directory.
Further, for ease of verification of correctness, redundant parenthesis has
been used around the expressions thus converted where there was felt to be
a possibility of confusion.
b22528e
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

Replacing only the simplest patterns

's#^(.*) if +([^ ]+) +or +([^ ]+)$#$1 if $2 || $3#g'
's#^(.*) if +([^ ]+) +and +([^ ]+)$#$1 if $2 && $3#g'
b185d45
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

Replacing only the pattern
's#^(.*) if +([^ ]+) +([!=~+-<>]+) +([^ ]+) and ([^ ]+) ([!=~+-><]+) +([^ \n]+)$#$1 if ($2 $3 $4) && ($5 $6 $7)#g'
's#^(.*) if +([^ ]+) +([!=~+-<>]+) +([^ ]+) or ([^ ]+) ([!=~+-><]+) +([^ \n]+)$#$1 if ($2 $3 $4) || ($5 $6 $7)#g'
b33cbd2
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

's#^(.*) if +([^ ]+) +([!=~+-<>]+) +([^ ]+) or ([^ \n]+)$#$1 if ($2 $3 $4) || $5#g'
's#^(.*) if +([^ ]+) or ([^ ]+) ([!=~+-><]+) +([^ \n]+)$#$1 if $2 || ($3 $4 $5)#g'
's#^(.*) if +([^ ]+) +([!=~+-<>]+) +([^ ]+) and ([^ \n]+)$#$1 if ($2 $3 $4) && $5#g'
's#^(.*) if +([^ ]+) and ([^ ]+) ([!=~+-><]+) +([^ \n]+)$#$1 if $2 && ($3 $4 $5)#g'
ceb6757
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

Only patterns
's#(.*) +unless +([^ ]+) +or +([^ ]+)$#$1 unless $2 || $3#g'
's#(.*) +unless +([^ ]+) +and +([^ ]+)$#$1 unless $2 && $3#g'
362eccd
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (fix spacing)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
17d509c
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

'%s#if ([^ ]+) and ([^ ]+) then#if $1 && $2 then#g'
'%s#if ([^ ]+) or ([^ ]+) then#if $1 || $2 then#g'
68c9f78
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (autocorrect)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

Rubocop: autocorrect
9c09914
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

replacing only patterns

's#([ ]*)if +([^ ]+) +and +([^ ]+)$#${1}if $2 && $3#g'
's#([ ]*)if +([^ ]+) +or +([^ ]+)$#${1}if $2 || $3#g'
's#([ ]*)if +([^ ]+) +and not +([^ ]+)$#${1}if $2 && !$3#g'
's#([ ]*)if not +([^ ]+) +and not +([^ ]+)$#${1}if !$2 && !$3#g'
's#([ ]*)if not +([^ ]+) +and +([^ ]+)$#${1}if !$2 && $3#g'
3c897e4
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (enable)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

This commit enables the `AndOr` cop
87f37e0
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
    Replacing only the simplest pattern

    s#^( *)if +([^ ]+) +and +([^ ]+)$#$1if $2 && $3#g
    s#^( *)if +([^ ]+) +or +([^ ]+)$#$1if $2 || $3#g
36edf3e
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

Replacing only patterns

's#^([^ ]+) +and +([^ ]+)$#$1 && $2#g'
's#^([^ ]+) +or +([^ ]+)$#$1 || $2#g'
's#^( *[^ ]+) +and +([^ ]+)$#$1 && $2#g'
's#^( *[^ ]+) +or +([^ ]+)$#$1 || $2#g'
1c2947b
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

'%s#if ([^ ]+) and ([^ ]+)#if $1 and $2#g'
c462af4
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

'%s#(.*) if ([^ ]+) and ([^ ]+) #$1 if $2 and $3 #g'
0bd2f43
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

'%s#(.*) if ([^ ]+) ([=!~]+) and ([^ ]+) #$1 if ($2) && $3 #g'
eef3cd4
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

's#^( *)([^ ]+) +or raise (.*)$#$1$2 || (raise $3)#g'
5aa7288
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:

's#^( *)([^ ]+) +or return (.*)$#$1$2 || (return $3)#g'
6323977
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
991192f
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
04682e4
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
6dd5a8c
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
7cdbedf
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
d020951
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
8b23501
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
f65ac6f
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in ext/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
06c1246
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
db4ae31
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
0767bd4
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
2857f93
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
2b4c73e
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
ac4ec81
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
b40b627
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
31d0801
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
ea4a8f6
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
60a6c75
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (final fixup)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
bdb3ce6
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
0c26fbd
@vrthra vrthra (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)
This is part of a series of commits that follows the same pattern. These
checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
so that future use of `and` and `or` is banned (and instead `&&` and `||` is
encouraged)

For the ease of modification, and to ensure that the possible errors remain a
minimum, we have attempted to make the changes as consistent to each other as
possible, and have also given preference to explicit parenthesis where doing so
helped.

Our approach has been to
- Let rubocopop autocorrect where possible
- Look for regular expression patterns that could catch the maximum number of
  violations without ambiguity, and apply these to the code, and then manually
  verify that the changes have indeed been correct (and correct where
  necessary).
- Once such patterns were exhausted, the remaining changes were done by hand.

REGEX USED:
  by hand
1856c0a
@adrienthebo
Owner

I'm concerned about the complete removal of and and or as flow control operators. My understanding is that we're removing these to make the code more consistent and readable but I think that doing a wholesale replacement of flow control operators with boolean operators may set us about as far back as removing the flow control operators will move us forward.

Take the following example:

-      execute_prerun_command or return nil
+      execute_prerun_command || (return nil)

I think that the latter is less clear than the former. Moreover, removing the parentheses is an illegal expression:

[1] pry(main)> def logical_comp
[1] pry(main)*   false or return :x
[1] pry(main)* end  
=> nil
[2] pry(main)> logical_comp
=> :x
[3] pry(main)> def boolean_comp
[3] pry(main)*   false || return :x
[3] pry(main)* end  
SyntaxError: unexpected tSYMBEG, expecting keyword_end
  false || return :x
                   ^
[3] pry(main)> def boolean_comp
[3] pry(main)*   false || (return :x)
[3] pry(main)* end  
=> nil

The flow control operators have a lower precedence for a specific reason - when explicitly used for flow control they behave correctly. Their very low precedence makes them suitable for this specific use case. As we've seen using flow control operators in conditional expressions can do surprising things, which is why we certainly should strip them from conditionals. However removing the flow control operators and replacing them with boolean operators will flip around the problem - instead of precedence in conditionals screwing us up, we'll have precedence in flow control doing unexpected things. This will remove one class of errors but introduce another.

We can continue forward with removing flow control operators for the sake of consistency and unambiguity, but doing this means that we should remove the use of flow control style operations entirely. Instead of using and/or/&&/|| we should use if instead. This will clearly indicate that we're doing flow control in the code and will completely sidestep the entire problem of operator precedence. However, if we're not going to replace flow control operators with true conditionals, then I don't think we should replace flow control operators at all.

@adrienthebo

Should this be a separate PR?

Collaborator

In the previous PR we handled the bugs exposed by Rubocop within the PR of Rubocop itself (See Josh's comment). Is a new PR necessary here?

If we have a precedent for fixing bugs exposed in the PR then let's continue to do that.

@adrienthebo

This commit message should indicate it's removing the spacing between ! and the following expression.

Collaborator

Sure, I will update the body (it is mentioned in the header)

@adrienthebo
Owner

General comment - the title of the commit should indicate a bit more about the changes it's introducing instead of having git log --oneline showing a series of commits with the same title.

@adrienthebo

Without the parens, this sort of change is an illegal expression:

[1] pry(main)> false || raise "boom!"
SyntaxError: unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
false || raise "boom!"
                ^

I think this is less clear than using or and is a good way to trip up people.

@vrthra
Collaborator

@adrienthebo it actually does indicate what has been changed. The regular expressions are too big to put on the commit line, so instead the specifics of the regular expressions have been put in the body. Here is the format of the commit line I adopted:

(PUP-2950) Enable rubocop Style/AndOr in lib/ %HOW%

where nothing is said if it was an automatic regular expression change, (no auto) indicates it was done by hand, (fix spacing) for removing spaces between operator ! and expression, (autocorrect) for letting rubocop do the correction, and (final fixup) for fixes for issues I found at the end.

@adrienthebo adrienthebo referenced this pull request in bbatsov/rubocop
Closed

Ban and/or on conditionals only #1232

@vrthra
Collaborator

@adrienthebo the thing about false || raise 'boom' is that it is a parse time error. You wont be able to load a ruby file which contains such an expression. So you are protected from such mistakes (Which is not the case with x = y or z where ambiguous parsing can trip you)

@adrienthebo
Owner

@vrthra yes, but my concern is that with the parens the code looks very unusual, and without them we run into the syntax error. By trying to outright ban the logical composition operators we have to use decorated and non-intuitive syntax instead, which I think is a loss rather than a gain.

@vrthra
Collaborator

Closing this to rework

@vrthra vrthra closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 29, 2014
  1. @vrthra

    (PUP-2950) ensure that default layer is used when the user has not pr…

    vrthra authored
    …ovided a layer
    
    Without this patch,
    
    ```
          unless diagnostics.errors?
            @layering_config   = data['layers'] or default_layers
            @scheme_extensions = (data['extensions'] and
                      data['extensions']['scheme_handlers'] or
                      default_scheme_extensions)
          else
            @layering_config = []
            @scheme_extensions = {}
          end
    ```
    This would have resulted in @layering_config not being assigned a value if no
    layers was set. This is clearly not intented. This patch updates the behavior
    so that `@layering_config` is assigned default_layers instead
    (by changing `or` to `||`)
    
    This commit also adds test cases to verify that this case is caught.
  2. @vrthra

    (PUP-2950) enabling rubocop Style/AndOr cop in pops directory

    vrthra authored
    This commits enables `AndOr` cop only in lib/puppet/pops directory. This cop
    bans the use of `and` and `or` keywords in favor of `&&` and `||`. We have
    chosen this directory as a test case to evaluate the utility of enabling
    `AndOr` on the complete codebase. We inherit from the base rubocop file, so all
    the other cops remain enabled. At a future date, when `AndOr` is enabled
    systemwide, this file may be removed (if no other specialization exists on pops
    directory).
    
    It changes all code that uses `and` and `or` keywords to use `&&` and
    `||`  instead. Note that this commit only fixes the lib/puppet/pops directory.
    Further, for ease of verification of correctness, redundant parenthesis has
    been used around the expressions thus converted where there was felt to be
    a possibility of confusion.
  3. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    Replacing only the simplest patterns
    
    's#^(.*) if +([^ ]+) +or +([^ ]+)$#$1 if $2 || $3#g'
    's#^(.*) if +([^ ]+) +and +([^ ]+)$#$1 if $2 && $3#g'
  4. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    Replacing only the pattern
    's#^(.*) if +([^ ]+) +([!=~+-<>]+) +([^ ]+) and ([^ ]+) ([!=~+-><]+) +([^ \n]+)$#$1 if ($2 $3 $4) && ($5 $6 $7)#g'
    's#^(.*) if +([^ ]+) +([!=~+-<>]+) +([^ ]+) or ([^ ]+) ([!=~+-><]+) +([^ \n]+)$#$1 if ($2 $3 $4) || ($5 $6 $7)#g'
  5. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    's#^(.*) if +([^ ]+) +([!=~+-<>]+) +([^ ]+) or ([^ \n]+)$#$1 if ($2 $3 $4) || $5#g'
    's#^(.*) if +([^ ]+) or ([^ ]+) ([!=~+-><]+) +([^ \n]+)$#$1 if $2 || ($3 $4 $5)#g'
    's#^(.*) if +([^ ]+) +([!=~+-<>]+) +([^ ]+) and ([^ \n]+)$#$1 if ($2 $3 $4) && $5#g'
    's#^(.*) if +([^ ]+) and ([^ ]+) ([!=~+-><]+) +([^ \n]+)$#$1 if $2 && ($3 $4 $5)#g'
  6. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    Only patterns
    's#(.*) +unless +([^ ]+) +or +([^ ]+)$#$1 unless $2 || $3#g'
    's#(.*) +unless +([^ ]+) +and +([^ ]+)$#$1 unless $2 && $3#g'
  7. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (fix spacing)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
  8. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    '%s#if ([^ ]+) and ([^ ]+) then#if $1 && $2 then#g'
    '%s#if ([^ ]+) or ([^ ]+) then#if $1 || $2 then#g'
  9. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (autocorrect)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    Rubocop: autocorrect
  10. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    replacing only patterns
    
    's#([ ]*)if +([^ ]+) +and +([^ ]+)$#${1}if $2 && $3#g'
    's#([ ]*)if +([^ ]+) +or +([^ ]+)$#${1}if $2 || $3#g'
    's#([ ]*)if +([^ ]+) +and not +([^ ]+)$#${1}if $2 && !$3#g'
    's#([ ]*)if not +([^ ]+) +and not +([^ ]+)$#${1}if !$2 && !$3#g'
    's#([ ]*)if not +([^ ]+) +and +([^ ]+)$#${1}if !$2 && $3#g'
  11. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (enable)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    This commit enables the `AndOr` cop
  12. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
        Replacing only the simplest pattern
    
        s#^( *)if +([^ ]+) +and +([^ ]+)$#$1if $2 && $3#g
        s#^( *)if +([^ ]+) +or +([^ ]+)$#$1if $2 || $3#g
  13. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    Replacing only patterns
    
    's#^([^ ]+) +and +([^ ]+)$#$1 && $2#g'
    's#^([^ ]+) +or +([^ ]+)$#$1 || $2#g'
    's#^( *[^ ]+) +and +([^ ]+)$#$1 && $2#g'
    's#^( *[^ ]+) +or +([^ ]+)$#$1 || $2#g'
  14. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    '%s#if ([^ ]+) and ([^ ]+)#if $1 and $2#g'
  15. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    '%s#(.*) if ([^ ]+) and ([^ ]+) #$1 if $2 and $3 #g'
  16. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    '%s#(.*) if ([^ ]+) ([=!~]+) and ([^ ]+) #$1 if ($2) && $3 #g'
  17. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    's#^( *)([^ ]+) +or raise (.*)$#$1$2 || (raise $3)#g'
  18. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
    
    's#^( *)([^ ]+) +or return (.*)$#$1$2 || (return $3)#g'
  19. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  20. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  21. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  22. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  23. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  24. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  25. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  26. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in ext/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  27. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  28. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
  29. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  30. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  31. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
  32. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
  33. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
  34. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
  35. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
  36. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (final fixup)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
  37. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
  38. @vrthra

    (PUP-2950) Enable rubocop Style/AndOr in lib/ (no auto)

    vrthra authored
    This is part of a series of commits that follows the same pattern. These
    checkins remove use of `and` and `or` keywords, and enable the Style/AndOr cop
    so that future use of `and` and `or` is banned (and instead `&&` and `||` is
    encouraged)
    
    For the ease of modification, and to ensure that the possible errors remain a
    minimum, we have attempted to make the changes as consistent to each other as
    possible, and have also given preference to explicit parenthesis where doing so
    helped.
    
    Our approach has been to
    - Let rubocopop autocorrect where possible
    - Look for regular expression patterns that could catch the maximum number of
      violations without ambiguity, and apply these to the code, and then manually
      verify that the changes have indeed been correct (and correct where
      necessary).
    - Once such patterns were exhausted, the remaining changes were done by hand.
    
    REGEX USED:
      by hand
Something went wrong with that request. Please try again.