Skip to content

Commit dbaeb02

Browse files
authored
Bump RuboCop to 0.47.1 (#89)
The change in the Dockerfile is motivated by this issue and it's suggested workaround: ku1ik/rainbow#48 I generated the docs outside of docker because the rake task doesn't currently work inside docker. I think that's fine. The `Registry` change is to maintain parity with an internal RuboCop refactoring that took place as part of this update.
1 parent 1eec00b commit dbaeb02

File tree

76 files changed

+1208
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1208
-72
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ WORKDIR /usr/src/app
44
COPY Gemfile /usr/src/app/
55
COPY Gemfile.lock /usr/src/app/
66

7-
RUN gem install bundler && \
7+
RUN gem update --system && \
8+
gem install bundler && \
89
bundle install -j 4 && \
910
rm -fr /usr/share/ri
1011

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
55
gem "activesupport", require: false
66
gem "parser", "~> 2.3.3.1"
77
gem "pry", require: false
8-
gem "rubocop", "~> 0.45", require: false
8+
gem "rubocop", "~> 0.47.1", require: false
99
gem "rubocop-migrations", require: false
1010
gem "rubocop-rspec", require: false
1111
gem "safe_yaml"

Gemfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ GEM
2020
coderay (~> 1.1.0)
2121
method_source (~> 0.8.1)
2222
slop (~> 3.4)
23-
rainbow (2.1.0)
23+
rainbow (2.2.1)
2424
rake (12.0.0)
2525
rspec (3.5.0)
2626
rspec-core (~> 3.5.0)
@@ -35,8 +35,8 @@ GEM
3535
diff-lcs (>= 1.2.0, < 2.0)
3636
rspec-support (~> 3.5.0)
3737
rspec-support (3.5.0)
38-
rubocop (0.46.0)
39-
parser (>= 2.3.1.1, < 3.0)
38+
rubocop (0.47.1)
39+
parser (>= 2.3.3.1, < 3.0)
4040
powerpack (~> 0.1)
4141
rainbow (>= 1.99.1, < 3.0)
4242
ruby-progressbar (~> 1.7)
@@ -51,7 +51,7 @@ GEM
5151
thread_safe (0.3.5)
5252
tzinfo (1.2.2)
5353
thread_safe (~> 0.1)
54-
unicode-display_width (1.1.2)
54+
unicode-display_width (1.1.3)
5555

5656
PLATFORMS
5757
ruby
@@ -62,10 +62,10 @@ DEPENDENCIES
6262
pry
6363
rake
6464
rspec
65-
rubocop (~> 0.45)
65+
rubocop (~> 0.47.1)
6666
rubocop-migrations
6767
rubocop-rspec
6868
safe_yaml
6969

7070
BUNDLED WITH
71-
1.13.6
71+
1.14.4

config/contents/lint/ambiguous_operator.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ This cop checks for ambiguous operators in the first argument of a
22
method invocation without parentheses.
33

44
### Example:
5-
array = [1, 2, 3]
5+
6+
# bad
67

78
# The `*` is interpreted as a splat operator but it could possibly be
8-
# a `*` method invocation (i.e. `do_something.*(array)`).
9-
do_something *array
9+
# a `*` method invocation (i.e. `do_something.*(some_array)`).
10+
do_something *some_array
11+
12+
### Example:
13+
14+
# good
1015

1116
# With parentheses, there's no ambiguity.
12-
do_something(*array)
17+
do_something(*some_array)

config/contents/lint/ambiguous_regexp_literal.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ This cop checks for ambiguous regexp literals in the first argument of
22
a method invocation without parentheses.
33

44
### Example:
5+
6+
# bad
7+
58
# This is interpreted as a method invocation with a regexp literal,
69
# but it could possibly be `/` method invocations.
710
# (i.e. `do_something./(pattern)./(i)`)
811
do_something /pattern/i
912

13+
### Example:
14+
15+
# good
16+
1017
# With parentheses, there's no ambiguity.
1118
do_something(/pattern/i)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
This cop checks for assignments in the conditions of
2+
if/while/until.
3+
4+
### Example:
5+
6+
# bad
7+
8+
if some_var = true
9+
do_something
10+
end
11+
12+
### Example:
13+
14+
# good
15+
16+
if some_var == true
17+
do_something
18+
end

config/contents/lint/block_alignment.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
This cop checks whether the end keywords are aligned properly for do
22
end blocks.
33

4-
Three modes are supported through the `AlignWith` configuration
5-
parameter:
4+
Three modes are supported through the `EnforcedStyleAlignWith`
5+
configuration parameter:
66

77
`start_of_block` : the `end` shall be aligned with the
88
start of the line where the `do` appeared.
@@ -15,18 +15,40 @@ location. The autofixer will default to `start_of_line`.
1515

1616
### Example:
1717

18-
# either
18+
# bad
19+
20+
foo.bar
21+
.each do
22+
baz
23+
end
24+
25+
### Example:
26+
27+
# EnforcedStyleAlignWith: either (default)
28+
29+
# good
30+
1931
variable = lambda do |i|
2032
i
2133
end
2234

23-
# start_of_block
35+
### Example:
36+
37+
# EnforcedStyleAlignWith: start_of_block
38+
39+
# good
40+
2441
foo.bar
2542
.each do
2643
baz
2744
end
2845

29-
# start_of_line
46+
### Example:
47+
48+
# EnforcedStyleAlignWith: start_of_line
49+
50+
# good
51+
3052
foo.bar
3153
.each do
3254
baz

config/contents/lint/circular_argument_reference.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,41 @@ arguments and optional ordinal arguments.
44
This cop mirrors a warning produced by MRI since 2.2.
55

66
### Example:
7+
78
# bad
9+
810
def bake(pie: pie)
911
pie.heat_up
1012
end
1113

14+
### Example:
15+
1216
# good
17+
1318
def bake(pie:)
1419
pie.refrigerate
1520
end
1621

22+
### Example:
23+
1724
# good
25+
1826
def bake(pie: self.pie)
1927
pie.feed_to(user)
2028
end
2129

30+
### Example:
31+
2232
# bad
33+
2334
def cook(dry_ingredients = dry_ingredients)
2435
dry_ingredients.reduce(&:+)
2536
end
2637

38+
### Example:
39+
2740
# good
41+
2842
def cook(dry_ingredients = self.dry_ingredients)
2943
dry_ingredients.combine
3044
end

config/contents/lint/condition_position.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ if/while/until.
33

44
### Example:
55

6+
# bad
7+
68
if
79
some_condition
810
do_something
11+
end
12+
13+
### Example:
14+
15+
# good
16+
17+
if some_condition
18+
do_something
919
end

config/contents/lint/debugger.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
This cop checks for calls to debugger or pry.
2+
3+
### Example:
4+
5+
# bad (ok during development)
6+
7+
# using pry
8+
def some_method
9+
binding.pry
10+
do_something
11+
end
12+
13+
### Example:
14+
15+
# bad (ok during development)
16+
17+
# using byebug
18+
def some_method
19+
byebug
20+
do_something
21+
end
22+
23+
### Example:
24+
25+
# good
26+
27+
def some_method
28+
do_something
29+
end

0 commit comments

Comments
 (0)