Skip to content

Commit 8e07fa6

Browse files
committed
Rubocop 0.51.0
* Updated docs * Added more docs
1 parent 8af37cc commit 8e07fa6

File tree

91 files changed

+1811
-129
lines changed

Some content is hidden

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

91 files changed

+1811
-129
lines changed

Gemfile

+1-1
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.4.0"
77
gem "pry", require: false
8-
gem "rubocop", "~> 0.50.0", require: false
8+
gem "rubocop", "~> 0.51.0", require: false
99
gem "rubocop-migrations", require: false
1010
gem "rubocop-rspec", require: false
1111
gem "safe_yaml"

Gemfile.lock

+18-17
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,34 @@ GEM
1010
coderay (1.1.2)
1111
concurrent-ruby (1.0.5)
1212
diff-lcs (1.3)
13-
i18n (0.8.6)
13+
i18n (0.9.0)
14+
concurrent-ruby (~> 1.0)
1415
method_source (0.9.0)
1516
minitest (5.10.3)
1617
parallel (1.12.0)
1718
parser (2.4.0.0)
1819
ast (~> 2.2)
1920
powerpack (0.1.1)
20-
pry (0.11.1)
21+
pry (0.11.2)
2122
coderay (~> 1.1.0)
2223
method_source (~> 0.9.0)
2324
rainbow (2.2.2)
2425
rake
2526
rake (12.1.0)
26-
rspec (3.6.0)
27-
rspec-core (~> 3.6.0)
28-
rspec-expectations (~> 3.6.0)
29-
rspec-mocks (~> 3.6.0)
30-
rspec-core (3.6.0)
31-
rspec-support (~> 3.6.0)
32-
rspec-expectations (3.6.0)
27+
rspec (3.7.0)
28+
rspec-core (~> 3.7.0)
29+
rspec-expectations (~> 3.7.0)
30+
rspec-mocks (~> 3.7.0)
31+
rspec-core (3.7.0)
32+
rspec-support (~> 3.7.0)
33+
rspec-expectations (3.7.0)
3334
diff-lcs (>= 1.2.0, < 2.0)
34-
rspec-support (~> 3.6.0)
35-
rspec-mocks (3.6.0)
35+
rspec-support (~> 3.7.0)
36+
rspec-mocks (3.7.0)
3637
diff-lcs (>= 1.2.0, < 2.0)
37-
rspec-support (~> 3.6.0)
38-
rspec-support (3.6.0)
39-
rubocop (0.50.0)
38+
rspec-support (~> 3.7.0)
39+
rspec-support (3.7.0)
40+
rubocop (0.51.0)
4041
parallel (~> 1.10)
4142
parser (>= 2.3.3.1, < 3.0)
4243
powerpack (~> 0.1)
@@ -45,8 +46,8 @@ GEM
4546
unicode-display_width (~> 1.0, >= 1.0.1)
4647
rubocop-migrations (0.1.2)
4748
rubocop (~> 0.41)
48-
rubocop-rspec (1.18.0)
49-
rubocop (>= 0.50.0)
49+
rubocop-rspec (1.19.0)
50+
rubocop (>= 0.51.0)
5051
ruby-progressbar (1.9.0)
5152
safe_yaml (1.0.4)
5253
thread_safe (0.3.6)
@@ -63,7 +64,7 @@ DEPENDENCIES
6364
pry
6465
rake
6566
rspec
66-
rubocop (~> 0.50.0)
67+
rubocop (~> 0.51.0)
6768
rubocop-migrations
6869
rubocop-rspec
6970
safe_yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Dependencies in the gemspec should be alphabetically sorted.
2+
3+
### Example:
4+
# bad
5+
spec.add_dependency 'rubocop'
6+
spec.add_dependency 'rspec'
7+
8+
# good
9+
spec.add_dependency 'rspec'
10+
spec.add_dependency 'rubocop'
11+
12+
# good
13+
spec.add_dependency 'rubocop'
14+
15+
spec.add_dependency 'rspec'
16+
17+
# bad
18+
spec.add_development_dependency 'rubocop'
19+
spec.add_development_dependency 'rspec'
20+
21+
# good
22+
spec.add_development_dependency 'rspec'
23+
spec.add_development_dependency 'rubocop'
24+
25+
# good
26+
spec.add_development_dependency 'rubocop'
27+
28+
spec.add_development_dependency 'rspec'
29+
30+
# bad
31+
spec.add_runtime_dependency 'rubocop'
32+
spec.add_runtime_dependency 'rspec'
33+
34+
# good
35+
spec.add_runtime_dependency 'rspec'
36+
spec.add_runtime_dependency 'rubocop'
37+
38+
# good
39+
spec.add_runtime_dependency 'rubocop'
40+
41+
spec.add_runtime_dependency 'rspec'
42+
43+
# good only if TreatCommentsAsGroupSeparators is true
44+
# For code quality
45+
spec.add_dependency 'rubocop'
46+
# For tests
47+
spec.add_dependency 'rspec'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Modifiers should be indented as deep as method definitions, or as deep
2+
as the class/module keyword, depending on configuration.
3+
4+
### Example:
5+
# EnforcedStyle: indent (default)
6+
7+
# bad
8+
class Plumbus
9+
private
10+
def smooth; end
11+
end
12+
13+
# good
14+
class Plumbus
15+
private
16+
def smooth; end
17+
end
18+
19+
# EnforcedStyle: outdent
20+
21+
# bad
22+
class Plumbus
23+
private
24+
def smooth; end
25+
end
26+
27+
# good
28+
class Plumbus
29+
private
30+
def smooth; end
31+
end

config/contents/layout/align_array.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Here we check if the elements of a multi-line array literal are
2+
aligned.
3+
4+
### Example:
5+
# bad
6+
a = [1, 2, 3,
7+
4, 5, 6]
8+
array = ['run',
9+
'forrest',
10+
'run']
11+
12+
# good
13+
a = [1, 2, 3,
14+
4, 5, 6]
15+
a = ['run',
16+
'forrest',
17+
'run']

config/contents/layout/align_hash.md

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
Check that the keys, separators, and values of a multi-line hash
2+
literal are aligned according to configuration. The configuration
3+
options are:
4+
5+
- key (left align keys)
6+
- separator (align hash rockets and colons, right align keys)
7+
- table (left align keys, hash rockets, and values)
8+
9+
The treatment of hashes passed as the last argument to a method call
10+
can also be configured. The options are:
11+
12+
- always_inspect
13+
- always_ignore
14+
- ignore_implicit (without curly braces)
15+
- ignore_explicit (with curly braces)
16+
17+
### Example:
18+
19+
# EnforcedHashRocketStyle: key (default)
20+
# EnforcedColonStyle: key (default)
21+
22+
# good
23+
{
24+
foo: bar,
25+
ba: baz
26+
}
27+
{
28+
:foo => bar,
29+
:ba => baz
30+
}
31+
32+
# bad
33+
{
34+
foo: bar,
35+
ba: baz
36+
}
37+
{
38+
:foo => bar,
39+
:ba => baz
40+
}
41+
42+
### Example:
43+
44+
# EnforcedHashRocketStyle: separator
45+
# EnforcedColonStyle: separator
46+
47+
#good
48+
{
49+
foo: bar,
50+
ba: baz
51+
}
52+
{
53+
:foo => bar,
54+
:ba => baz
55+
}
56+
57+
#bad
58+
{
59+
foo: bar,
60+
ba: baz
61+
}
62+
{
63+
:foo => bar,
64+
:ba => baz
65+
}
66+
{
67+
:foo => bar,
68+
:ba => baz
69+
}
70+
71+
### Example:
72+
73+
# EnforcedHashRocketStyle: table
74+
# EnforcedColonStyle: table
75+
76+
#good
77+
{
78+
foo: bar,
79+
ba: baz
80+
}
81+
{
82+
:foo => bar,
83+
:ba => baz
84+
}
85+
86+
#bad
87+
{
88+
foo: bar,
89+
ba: baz
90+
}
91+
{
92+
:foo => bar,
93+
:ba => baz
94+
}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Here we check if the parameters on a multi-line method call or
2+
definition are aligned.
3+
4+
### Example:
5+
6+
# EnforcedStyle: with_first_parameter
7+
8+
# good
9+
10+
foo :bar,
11+
:baz
12+
13+
# bad
14+
15+
foo :bar,
16+
:baz
17+
18+
### Example:
19+
20+
# EnforcedStyle: with_fixed_indentation
21+
22+
# good
23+
24+
foo :bar,
25+
:baz
26+
27+
# bad
28+
29+
foo :bar,
30+
:baz
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
This cop checks whether the end statement of a do..end block
2+
is on its own line.
3+
4+
### Example:
5+
# bad
6+
blah do |i|
7+
foo(i) end
8+
9+
# good
10+
blah do |i|
11+
foo(i)
12+
end
13+
14+
# bad
15+
blah { |i|
16+
foo(i) }
17+
18+
# good
19+
blah { |i|
20+
foo(i)
21+
}
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
This cop checks how the *when*s of a *case* expression
2+
are indented in relation to its *case* or *end* keyword.
3+
4+
It will register a separate offense for each misaligned *when*.
5+
6+
### Example:
7+
# If Layout/EndAlignment is set to keyword style (default)
8+
# *case* and *end* should always be aligned to same depth,
9+
# and therefore *when* should always be aligned to both -
10+
# regardless of configuration.
11+
12+
# bad for all styles
13+
case n
14+
when 0
15+
x * 2
16+
else
17+
y / 3
18+
end
19+
20+
# good for all styles
21+
case n
22+
when 0
23+
x * 2
24+
else
25+
y / 3
26+
end
27+
28+
### Example:
29+
# if EndAlignment is set to other style such as
30+
# start_of_line (as shown below), then *when* alignment
31+
# configuration does have an effect.
32+
33+
# EnforcedStyle: case (default)
34+
35+
# bad
36+
a = case n
37+
when 0
38+
x * 2
39+
else
40+
y / 3
41+
end
42+
43+
# good
44+
a = case n
45+
when 0
46+
x * 2
47+
else
48+
y / 3
49+
end
50+
51+
# EnforcedStyle: end
52+
53+
# bad
54+
a = case n
55+
when 0
56+
x * 2
57+
else
58+
y / 3
59+
end
60+
61+
# good
62+
a = case n
63+
when 0
64+
x * 2
65+
else
66+
y / 3
67+
end

0 commit comments

Comments
 (0)