Skip to content

Commit c81fd67

Browse files
authored
Add channel/rubocop-1-18-3 (#290)
* Update rubocop to v1.13.0 * Update scraped documentation * Update rubocop to v1.14.0 * Update scraped documentation * Update rubocop to v1.15.0 * Update scraped documentation * Update rubocop to v1.16.0 * Update scraped documentation * Update spec/support/config_upgrader_rubocop.yml * Update rubocop to v1.16.1 * Update rubocop to v1.17.0 * Update scraped documentation * Update rubocop to v1.18.2 * Update scraped documentation * Update spec/support/config_upgrader_rubocop.yml * Update rubocop to v1.18.3 * Update scraped documentation
1 parent 3ca16e8 commit c81fd67

29 files changed

+633
-31
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", "1.12.1", require: false
9+
gem "rubocop", "1.18.3", require: false
1010
gem "rubocop-i18n", require: false
1111
gem "rubocop-graphql", require: false
1212
gem "rubocop-minitest", require: false

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ GEM
4141
diff-lcs (>= 1.2.0, < 2.0)
4242
rspec-support (~> 3.9.0)
4343
rspec-support (3.9.3)
44-
rubocop (1.12.1)
44+
rubocop (1.18.3)
4545
parallel (~> 1.10)
4646
parser (>= 3.0.0.0)
4747
rainbow (>= 2.2.2, < 4.0)
4848
regexp_parser (>= 1.8, < 3.0)
4949
rexml
50-
rubocop-ast (>= 1.2.0, < 2.0)
50+
rubocop-ast (>= 1.7.0, < 2.0)
5151
ruby-progressbar (~> 1.7)
5252
unicode-display_width (>= 1.4.0, < 3.0)
5353
rubocop-ast (1.7.0)
@@ -93,7 +93,7 @@ DEPENDENCIES
9393
pry
9494
rake
9595
rspec
96-
rubocop (= 1.12.1)
96+
rubocop (= 1.18.3)
9797
rubocop-graphql
9898
rubocop-i18n
9999
rubocop-minitest

config/contents/bundler/gem_comment.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
Add a comment describing each gem in your Gemfile.
1+
Each gem in the Gemfile should have a comment explaining
2+
its purpose in the project, or the reason for its version
3+
or source.
24

3-
Optionally, the "OnlyFor" configuration
5+
The optional "OnlyFor" configuration array
46
can be used to only register offenses when the gems
57
use certain options or have version specifiers.
6-
Add "version_specifiers" and/or the gem option names
7-
you want to check.
88

9-
A useful use-case is to enforce a comment when using
9+
When "version_specifiers" is included, a comment
10+
will be enforced if the gem has any version specifier.
11+
12+
When "restrictive_version_specifiers" is included, a comment
13+
will be enforced if the gem has a version specifier that
14+
holds back the version of the gem.
15+
16+
For any other value in the array, a comment will be enforced for
17+
a gem if an option by the same name is present.
18+
A useful use case is to enforce a comment when using
1019
options that change the source of a gem:
1120

1221
- `bitbucket`
@@ -16,7 +25,8 @@ options that change the source of a gem:
1625
- `source`
1726

1827
For a full list of options supported by bundler,
19-
you can check the https://bundler.io/man/gemfile.5.html[official documentation].
28+
see https://bundler.io/man/gemfile.5.html
29+
.
2030

2131
### Example: OnlyFor: [] (default)
2232
# bad
@@ -38,6 +48,18 @@ you can check the https://bundler.io/man/gemfile.5.html[official documentation].
3848
# Version 2.1 introduces breaking change baz
3949
gem 'foo', '< 2.1'
4050

51+
### Example: OnlyFor: ['restrictive_version_specifiers']
52+
# bad
53+
54+
gem 'foo', '< 2.1'
55+
56+
# good
57+
58+
gem 'foo', '>= 1.0'
59+
60+
# Version 2.1 introduces breaking change baz
61+
gem 'foo', '< 2.1'
62+
4163
### Example: OnlyFor: ['version_specifiers', 'github']
4264
# bad
4365

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Enforce that Gem version specifications or a commit reference (branch,
2+
ref, or tag) are either required or forbidden.
3+
4+
### Example: EnforcedStyle: required (default)
5+
# bad
6+
gem 'rubocop'
7+
8+
# good
9+
gem 'rubocop', '~> 1.12'
10+
11+
# good
12+
gem 'rubocop', '>= 1.10.0'
13+
14+
# good
15+
gem 'rubocop', '>= 1.5.0', '< 1.10.0'
16+
17+
# good
18+
gem 'rubocop', branch: 'feature-branch'
19+
20+
# good
21+
gem 'rubocop', ref: '74b5bfbb2c4b6fd6cdbbc7254bd7084b36e0c85b'
22+
23+
# good
24+
gem 'rubocop', tag: 'v1.17.0'
25+
26+
### Example: EnforcedStyle: forbidden
27+
# good
28+
gem 'rubocop'
29+
30+
# bad
31+
gem 'rubocop', '~> 1.12'
32+
33+
# bad
34+
gem 'rubocop', '>= 1.10.0'
35+
36+
# bad
37+
gem 'rubocop', '>= 1.5.0', '< 1.10.0'
38+
39+
# bad
40+
gem 'rubocop', branch: 'feature-branch'
41+
42+
# bad
43+
gem 'rubocop', ref: '74b5bfbb2c4b6fd6cdbbc7254bd7084b36e0c85b'
44+
45+
# bad
46+
gem 'rubocop', tag: 'v1.17.0'

config/contents/layout/argument_alignment.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,36 @@ definition are aligned.
55
# good
66

77
foo :bar,
8-
:baz
8+
:baz,
9+
key: value
910

1011
foo(
1112
:bar,
12-
:baz
13+
:baz,
14+
key: value
1315
)
1416

1517
# bad
1618

1719
foo :bar,
18-
:baz
20+
:baz,
21+
key: value
1922

2023
foo(
2124
:bar,
22-
:baz
25+
:baz,
26+
key: value
2327
)
2428

2529
### Example: EnforcedStyle: with_fixed_indentation
2630
# good
2731

2832
foo :bar,
29-
:baz
33+
:baz,
34+
key: value
3035

3136
# bad
3237

3338
foo :bar,
34-
:baz
39+
:baz,
40+
key: value

config/contents/layout/case_indentation.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
This cop checks how the ``when``s of a `case` expression
1+
This cop checks how the `when` and `in`s of a `case` expression
22
are indented in relation to its `case` or `end` keyword.
33

4-
It will register a separate offense for each misaligned `when`.
4+
It will register a separate offense for each misaligned `when` and `in`.
55

66
### Example:
77
# If Layout/EndAlignment is set to keyword style (default)
@@ -17,6 +17,13 @@ It will register a separate offense for each misaligned `when`.
1717
y / 3
1818
end
1919

20+
case n
21+
in pattern
22+
x * 2
23+
else
24+
y / 3
25+
end
26+
2027
# good for all styles
2128
case n
2229
when 0
@@ -25,6 +32,13 @@ It will register a separate offense for each misaligned `when`.
2532
y / 3
2633
end
2734

35+
case n
36+
in pattern
37+
x * 2
38+
else
39+
y / 3
40+
end
41+
2842
### Example: EnforcedStyle: case (default)
2943
# if EndAlignment is set to other style such as
3044
# start_of_line (as shown below), then *when* alignment
@@ -38,6 +52,13 @@ It will register a separate offense for each misaligned `when`.
3852
y / 3
3953
end
4054

55+
a = case n
56+
in pattern
57+
x * 2
58+
else
59+
y / 3
60+
end
61+
4162
# good
4263
a = case n
4364
when 0
@@ -46,6 +67,13 @@ It will register a separate offense for each misaligned `when`.
4667
y / 3
4768
end
4869

70+
a = case n
71+
in pattern
72+
x * 2
73+
else
74+
y / 3
75+
end
76+
4977
### Example: EnforcedStyle: end
5078
# bad
5179
a = case n
@@ -55,10 +83,24 @@ It will register a separate offense for each misaligned `when`.
5583
y / 3
5684
end
5785

86+
a = case n
87+
in pattern
88+
x * 2
89+
else
90+
y / 3
91+
end
92+
5893
# good
5994
a = case n
6095
when 0
6196
x * 2
6297
else
6398
y / 3
99+
end
100+
101+
a = case n
102+
in pattern
103+
x * 2
104+
else
105+
y / 3
64106
end
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
This cop checks the indentation of the next line after a line that ends with a string
2+
literal and a backslash.
3+
4+
If `EnforcedStyle: aligned` is set, the concatenated string parts shall be aligned with the
5+
first part. There are some exceptions, such as implicit return values, where the
6+
concatenated string parts shall be indented regardless of `EnforcedStyle` configuration.
7+
8+
If `EnforcedStyle: indented` is set, it's the second line that shall be indented one step
9+
more than the first line. Lines 3 and forward shall be aligned with line 2. Here too there
10+
are exceptions. Values in a hash literal are always aligned.
11+
12+
### Example:
13+
# bad
14+
def some_method
15+
'x' \
16+
'y' \
17+
'z'
18+
end
19+
20+
my_hash = {
21+
first: 'a message' \
22+
'in two parts'
23+
}
24+
25+
# good
26+
def some_method
27+
'x' \
28+
'y' \
29+
'z'
30+
end
31+
32+
my_hash = {
33+
first: 'a message' \
34+
'in two parts'
35+
}
36+
37+
### Example: EnforcedStyle: aligned (default)
38+
# bad
39+
puts 'x' \
40+
'y'
41+
42+
# good
43+
puts 'x' \
44+
'y'
45+
46+
### Example: EnforcedStyle: indented
47+
# bad
48+
result = 'x' \
49+
'y'
50+
51+
# good
52+
result = 'x' \
53+
'y'
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
This cop checks whether certain expressions, e.g. method calls, that could fit
2+
completely on a single line, are broken up into multiple lines unnecessarily.
3+
4+
### Example: any configuration
5+
# bad
6+
foo(
7+
a,
8+
b
9+
)
10+
11+
puts 'string that fits on ' \
12+
'a single line'
13+
14+
things
15+
.select { |thing| thing.cond? }
16+
.join('-')
17+
18+
# good
19+
foo(a, b)
20+
21+
puts 'string that fits on a single line'
22+
23+
things.select { |thing| thing.cond? }.join('-')
24+
25+
### Example: InspectBlocks: false (default)
26+
# good
27+
foo(a) do |x|
28+
puts x
29+
end
30+
31+
### Example: InspectBlocks: true
32+
# bad
33+
foo(a) do |x|
34+
puts x
35+
end
36+
37+
# good
38+
foo(a) { |x| puts x }
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
This cop checks if method calls are chained onto single line blocks. It considers that a
2+
line break before the dot improves the readability of the code.
3+
4+
### Example:
5+
# bad
6+
example.select { |item| item.cond? }.join('-')
7+
8+
# good
9+
example.select { |item| item.cond? }
10+
.join('-')
11+
12+
# good (not a concern for this cop)
13+
example.select do |item|
14+
item.cond?
15+
end.join('-')

0 commit comments

Comments
 (0)