Skip to content

Commit cdf2b9c

Browse files
authored
Updated channel and documentation to Rubocop v0.90.0 (#256)
* Bumps 'rubocop' Dependency to 0.90.0 * Updates Scraped Documentation * Fixes Broken ConfigUpgrader Spec * Fixes Broken CC::Engine::Rubocop Spec Look upon my metaprogramming, ye mighty, and despair.
1 parent cec40f2 commit cdf2b9c

23 files changed

+387
-46
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.89.1", require: false
9+
gem "rubocop", "0.90.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ GEM
4141
diff-lcs (>= 1.2.0, < 2.0)
4242
rspec-support (~> 3.9.0)
4343
rspec-support (3.9.3)
44-
rubocop (0.89.1)
44+
rubocop (0.90.0)
4545
parallel (~> 1.10)
4646
parser (>= 2.7.1.1)
4747
rainbow (>= 2.2.2, < 4.0)
@@ -91,7 +91,7 @@ DEPENDENCIES
9191
pry
9292
rake
9393
rspec
94-
rubocop (= 0.89.1)
94+
rubocop (= 0.90.0)
9595
rubocop-i18n
9696
rubocop-migrations
9797
rubocop-minitest
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
This cop enforces empty line after multiline condition.
2+
3+
### Example:
4+
# bad
5+
if multiline &&
6+
condition
7+
do_something
8+
end
9+
10+
# good
11+
if multiline &&
12+
condition
13+
14+
do_something
15+
end
16+
17+
# bad
18+
case x
19+
when foo,
20+
bar
21+
do_something
22+
end
23+
24+
# good
25+
case x
26+
when foo,
27+
bar
28+
29+
do_something
30+
end
31+
32+
# bad
33+
begin
34+
do_something
35+
rescue FooError,
36+
BarError
37+
handle_error
38+
end
39+
40+
# good
41+
begin
42+
do_something
43+
rescue FooError,
44+
BarError
45+
46+
handle_error
47+
end

config/contents/layout/heredoc_indentation.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ Note: When ``Layout/LineLength``'s `AllowHeredoc` is false (not default),
1515
<<~RUBY
1616
something
1717
RUBY
18-

config/contents/layout/space_before_comma.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ Checks for comma (,) preceded by space.
99
# good
1010
[1, 2, 3]
1111
a(1, 2)
12-
each { |a, b| }
12+
each { |a, b| }
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
This cop checks for duplicate `require`s and `require_relative`s.
2+
3+
### Example:
4+
# bad
5+
require 'foo'
6+
require 'bar'
7+
require 'foo'
8+
9+
# good
10+
require 'foo'
11+
require 'bar'

config/contents/lint/empty_file.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
This cop enforces that Ruby source files are not empty.
2+
3+
### Example:
4+
# bad
5+
# Empty file
6+
7+
# good
8+
# File containing non commented source lines
9+
10+
### Example: AllowComments: true (default)
11+
# good
12+
# File consisting only of comments
13+
14+
### Example: AllowComments: false
15+
# bad
16+
# File consisting only of comments

config/contents/lint/shadowing_outer_local_variable.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
This cop looks for use of the same name as outer local variables
2-
for block arguments or block local variables.
3-
This is a mimic of the warning
4-
"shadowing outer local variable - foo" from `ruby -cw`.
1+
This cop checks for the use of local variable names from an outer scope
2+
in block arguments or block-local variables. This mirrors the warning
3+
given by `ruby -cw` prior to Ruby 2.6:
4+
"shadowing outer local variable - foo".
55

66
### Example:
77

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
This cop checks for trailing commas in attribute declarations, such as
2+
`#attr_reader`. Leaving a trailing comma will nullify the next method
3+
definition by overriding it with a getter method.
4+
5+
### Example:
6+
7+
# bad
8+
class Foo
9+
attr_reader :foo,
10+
11+
def bar
12+
puts "Unreachable."
13+
end
14+
end
15+
16+
# good
17+
class Foo
18+
attr_reader :foo
19+
20+
def bar
21+
puts "No problem!"
22+
end
23+
end
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This cop checks for useless method definitions, specifically: empty constructors
2+
and methods just delegating to `super`.
3+
4+
This cop is marked as unsafe as it can trigger false positives for cases when
5+
an empty constructor just overrides the parent constructor, which is bad anyway.
6+
7+
### Example:
8+
# bad
9+
def initialize
10+
end
11+
12+
def method
13+
super
14+
end
15+
16+
# good
17+
def initialize
18+
initialize_internals
19+
end
20+
21+
def method
22+
super
23+
do_something_else
24+
end
25+
26+
### Example: AllowComments: true (default)
27+
# good
28+
def initialize
29+
# Comment.
30+
end
31+
32+
### Example: AllowComments: false
33+
# bad
34+
def initialize
35+
# Comment.
36+
end

0 commit comments

Comments
 (0)