Skip to content

Commit 0b1e4f7

Browse files
authored
Updated channel and documentation to Rubocop v0.83.0 (#235)
* Bumps 'rubocop' Dependency to v0.83.0 Also fixes broken config-upgrader spec to accommodate new cops. * Updates Scraped Documentation
1 parent 3959883 commit 0b1e4f7

13 files changed

+110
-33
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ gem "activesupport", require: false
66
gem "mry", require: false
77
gem "parser"
88
gem "pry", require: false
9-
gem "rubocop", "0.82.0", require: false
9+
gem "rubocop", "0.83.0", require: false
1010
gem "rubocop-i18n", require: false
1111
gem "rubocop-migrations", require: false
1212
gem "rubocop-minitest", require: false

Gemfile.lock

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ GEM
1313
diff-lcs (1.3)
1414
i18n (1.7.0)
1515
concurrent-ruby (~> 1.0)
16-
jaro_winkler (1.5.4)
1716
method_source (0.9.2)
1817
minitest (5.13.0)
1918
mry (0.59.0.0)
2019
rubocop (>= 0.41.0)
2120
parallel (1.19.1)
22-
parser (2.7.1.1)
21+
parser (2.7.1.2)
2322
ast (~> 2.4.0)
2423
pry (0.12.2)
2524
coderay (~> 1.1.0)
@@ -41,8 +40,7 @@ GEM
4140
diff-lcs (>= 1.2.0, < 2.0)
4241
rspec-support (~> 3.9.0)
4342
rspec-support (3.9.0)
44-
rubocop (0.82.0)
45-
jaro_winkler (~> 1.5.1)
43+
rubocop (0.83.0)
4644
parallel (~> 1.10)
4745
parser (>= 2.7.0.1)
4846
rainbow (>= 2.2.2, < 4.0)
@@ -83,7 +81,7 @@ DEPENDENCIES
8381
pry
8482
rake
8583
rspec
86-
rubocop (= 0.82.0)
84+
rubocop (= 0.83.0)
8785
rubocop-i18n
8886
rubocop-migrations
8987
rubocop-minitest
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Checks for a newline after attribute accessor.
2+
3+
### Example:
4+
# bad
5+
attr_accessor :foo
6+
def do_something
7+
end
8+
9+
# good
10+
attr_accessor :foo
11+
12+
def do_something
13+
end
14+
15+
# good
16+
attr_accessor :foo
17+
attr_reader :bar
18+
attr_writer :baz
19+
attr :qux
20+
21+
def do_something
22+
end
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
11
This cop checks the indentation of the right hand side operand in
22
binary operations that span more than one line.
33

4+
The `aligned` style checks that operators are aligned if they are part
5+
of an `if` or `while` condition, a `return` statement, etc. In other
6+
contexts, the second operand should be indented regardless of enforced
7+
style.
8+
49
### Example: EnforcedStyle: aligned (default)
510
# bad
611
if a +
712
b
8-
something
13+
something &&
14+
something_else
915
end
1016

1117
# good
1218
if a +
1319
b
14-
something
20+
something &&
21+
something_else
1522
end
1623

1724
### Example: EnforcedStyle: indented
1825
# bad
1926
if a +
2027
b
21-
something
28+
something &&
29+
something_else
2230
end
2331

2432
# good
2533
if a +
2634
b
27-
something
35+
something &&
36+
something_else
2837
end

config/contents/layout/trailing_whitespace.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ This cop looks for trailing whitespace in the source code.
99
# good
1010
x = 0
1111

12-
### Example: AllowInHeredoc: false (default)
12+
### Example: AllowInHeredoc: false
1313
# The line in this example contains spaces after the 0.
1414
# bad
1515
code = <<~RUBY
1616
x = 0
1717
RUBY
1818

19-
### Example: AllowInHeredoc: true
19+
### Example: AllowInHeredoc: true (default)
2020
# The line in this example contains spaces after the 0.
2121
# good
2222
code = <<~RUBY

config/contents/lint/empty_when.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,38 @@ This cop checks for the presence of `when` branches without a body.
33
### Example:
44

55
# bad
6-
76
case foo
8-
when bar then 1
9-
when baz then # nothing
7+
when bar
8+
do_something
9+
when baz
1010
end
1111

1212
### Example:
1313

1414
# good
15+
case condition
16+
when foo
17+
do_something
18+
when bar
19+
nil
20+
end
1521

16-
case foo
17-
when bar then 1
18-
when baz then 2
19-
end
22+
### Example: AllowComments: true (default)
23+
24+
# good
25+
case condition
26+
when foo
27+
do_something
28+
when bar
29+
# noop
30+
end
31+
32+
### Example: AllowComments: false
33+
34+
# bad
35+
case condition
36+
when foo
37+
do_something
38+
when bar
39+
# do nothing
40+
end

config/contents/lint/literal_as_condition.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,22 @@ if/while/until.
55
### Example:
66

77
# bad
8-
98
if 20
109
do_something
1110
end
1211

13-
### Example:
14-
1512
# bad
16-
1713
if some_var && true
1814
do_something
1915
end
2016

21-
### Example:
22-
2317
# good
24-
2518
if some_var && some_condition
2619
do_something
20+
end
21+
22+
# good
23+
# When using a boolean value for an infinite loop.
24+
while true
25+
break if condition
2726
end

config/contents/lint/parentheses_as_grouped_expression.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ parenthesis.
44
### Example:
55

66
# bad
7-
8-
puts (x + y)
9-
10-
### Example:
7+
do_something (foo)
118

129
# good
13-
14-
puts(x + y)
10+
do_something(foo)
11+
do_something (2 + 3) * 4
12+
do_something (foo * bar).baz

config/contents/style/guard_clause.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,15 @@ expression
2929

3030
# good
3131
raise 'exception' if something
32+
ok
33+
34+
# bad
35+
if something
36+
foo || raise('exception')
37+
else
38+
ok
39+
end
40+
41+
# good
42+
foo || raise('exception') if something
3243
ok

config/contents/style/multiline_when_then.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ in multi-line when statements.
1616
case foo
1717
when bar then do_something
1818
end
19+
20+
# good
21+
case foo
22+
when bar then do_something(arg1,
23+
arg2)
24+
end

0 commit comments

Comments
 (0)