Skip to content

Commit 2b84b3e

Browse files
committed
Update generated documentation
1 parent c53aa79 commit 2b84b3e

File tree

283 files changed

+6427
-494
lines changed

Some content is hidden

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

283 files changed

+6427
-494
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Add a comment describing each gem in your Gemfile.
2+
3+
Optionally, the "OnlyFor" configuration
4+
can be used to only register offenses when the gems
5+
use certain options or have version specifiers.
6+
Add "version_specifiers" and/or the gem option names
7+
you want to check.
8+
9+
A useful use-case is to enforce a comment when using
10+
options that change the source of a gem:
11+
12+
- `bitbucket`
13+
- `gist`
14+
- `git`
15+
- `github`
16+
- `source`
17+
18+
For a full list of options supported by bundler,
19+
you can check the https://bundler.io/man/gemfile.5.html[official documentation].
20+
21+
### Example: OnlyFor: [] (default)
22+
# bad
23+
24+
gem 'foo'
25+
26+
# good
27+
28+
# Helpers for the foo things.
29+
gem 'foo'
30+
31+
### Example: OnlyFor: ['version_specifiers']
32+
# bad
33+
34+
gem 'foo', '< 2.1'
35+
36+
# good
37+
38+
# Version 2.1 introduces breaking change baz
39+
gem 'foo', '< 2.1'
40+
41+
### Example: OnlyFor: ['version_specifiers', 'github']
42+
# bad
43+
44+
gem 'foo', github: 'some_account/some_fork_of_foo'
45+
46+
gem 'bar', '< 2.1'
47+
48+
# good
49+
50+
# Using this fork because baz
51+
gem 'foo', github: 'some_account/some_fork_of_foo'
52+
53+
# Version 2.1 introduces breaking change baz
54+
gem 'bar', '< 2.1'

config/contents/bundler/insecure_protocol_source.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The symbol argument `:gemcutter`, `:rubygems` and `:rubyforge`
1+
The symbol argument `:gemcutter`, `:rubygems`, and `:rubyforge`
22
are deprecated. So please change your source to URL string that
33
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
44

@@ -8,8 +8,8 @@ most use cases HTTPS will be fine.
88

99
However, it don't replace all `sources` of `http://` with `https://`.
1010
For example, when specifying an internal gem server using HTTP on the
11-
intranet, a use case where HTTPS can not be specified was considered.
12-
Consider using HTTP only if you can not use HTTPS.
11+
intranet, a use case where HTTPS cannot be specified was considered.
12+
Consider using HTTP only if you cannot use HTTPS.
1313

1414
### Example:
1515
# bad
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
If there are no parentheses around the arguments, then braces
2+
and do-end have different meaning due to how they bind, so we
3+
allow either.

config/contents/gemspec/duplicated_assignment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ in a gemspec.
33

44
Assigning to an attribute with the same name using `spec.foo =` will be
55
an unintended usage. On the other hand, duplication of methods such
6-
as `spec.requirements`, `spec.add_runtime_dependency` and others are
6+
as `spec.requirements`, `spec.add_runtime_dependency`, and others are
77
permitted because it is the intended use of appending values.
88

99
### Example:
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,42 @@
1-
Checks that `required_ruby_version` of gemspec and `TargetRubyVersion`
2-
of .rubocop.yml are equal.
1+
Checks that `required_ruby_version` of gemspec is specified and
2+
equal to `TargetRubyVersion` of .rubocop.yml.
33
Thereby, RuboCop to perform static analysis working on the version
44
required by gemspec.
55

66
### Example:
7-
# When `TargetRubyVersion` of .rubocop.yml is `2.3`.
7+
# When `TargetRubyVersion` of .rubocop.yml is `2.5`.
88

99
# bad
1010
Gem::Specification.new do |spec|
11-
spec.required_ruby_version = '>= 2.2.0'
11+
# no `required_ruby_version` specified
1212
end
1313

1414
# bad
1515
Gem::Specification.new do |spec|
1616
spec.required_ruby_version = '>= 2.4.0'
1717
end
1818

19+
# bad
20+
Gem::Specification.new do |spec|
21+
spec.required_ruby_version = '>= 2.6.0'
22+
end
23+
24+
# good
25+
Gem::Specification.new do |spec|
26+
spec.required_ruby_version = '>= 2.5.0'
27+
end
28+
1929
# good
2030
Gem::Specification.new do |spec|
21-
spec.required_ruby_version = '>= 2.3.0'
31+
spec.required_ruby_version = '>= 2.5'
2232
end
2333

2434
# good
2535
Gem::Specification.new do |spec|
26-
spec.required_ruby_version = '>= 2.3'
36+
spec.required_ruby_version = ['>= 2.5.0', '< 2.7.0']
2737
end
2838

2939
# good
3040
Gem::Specification.new do |spec|
31-
spec.required_ruby_version = ['>= 2.3.0', '< 2.5.0']
41+
spec.required_ruby_version = '~> 2.5'
3242
end
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Checks that `RUBY_VERSION` constant is not used in gemspec.
2+
Using `RUBY_VERSION` is dangerous because value of the
3+
constant is determined by `rake release`.
4+
It's possible to have dependency based on ruby version used
5+
to execute `rake release` and not user's ruby version.
6+
7+
### Example:
8+
9+
# bad
10+
Gem::Specification.new do |spec|
11+
if RUBY_VERSION >= '2.5'
12+
spec.add_runtime_dependency 'gem_a'
13+
else
14+
spec.add_runtime_dependency 'gem_b'
15+
end
16+
end
17+
18+
# good
19+
Gem::Specification.new do |spec|
20+
spec.add_runtime_dependency 'gem_a'
21+
end

config/contents/layout/access_modifier_indentation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
Modifiers should be indented as deep as method definitions, or as deep
2-
as the class/module keyword, depending on configuration.
1+
Bare access modifiers (those not applying to specific methods) should be
2+
indented as deep as method definitions, or as deep as the class/module
3+
keyword, depending on configuration.
34

45
### Example: EnforcedStyle: indent (default)
56
# bad
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Here we check if the arguments on a multi-line method
2+
definition are aligned.
3+
4+
### Example: EnforcedStyle: with_first_argument (default)
5+
# good
6+
7+
foo :bar,
8+
:baz
9+
10+
foo(
11+
:bar,
12+
:baz
13+
)
14+
15+
# bad
16+
17+
foo :bar,
18+
:baz
19+
20+
foo(
21+
:bar,
22+
:baz
23+
)
24+
25+
### Example: EnforcedStyle: with_fixed_indentation
26+
# good
27+
28+
foo :bar,
29+
:baz
30+
31+
# bad
32+
33+
foo :bar,
34+
:baz
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Here we check if the elements of a multi-line array literal are
2+
aligned.
3+
4+
### Example: EnforcedStyle: with_first_element (default)
5+
# good
6+
7+
array = [1, 2, 3,
8+
4, 5, 6]
9+
array = ['run',
10+
'forrest',
11+
'run']
12+
13+
# bad
14+
15+
array = [1, 2, 3,
16+
4, 5, 6]
17+
array = ['run',
18+
'forrest',
19+
'run']
20+
21+
### Example: EnforcedStyle: with_fixed_indentation
22+
# good
23+
24+
array = [1, 2, 3,
25+
4, 5, 6]
26+
27+
# bad
28+
29+
array = [1, 2, 3,
30+
4, 5, 6]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
This cop checks the indentation of the first line of the
2+
right-hand-side of a multi-line assignment.
3+
4+
### Example:
5+
# bad
6+
value =
7+
if foo
8+
'bar'
9+
end
10+
11+
# good
12+
value =
13+
if foo
14+
'bar'
15+
end
16+
17+
The indentation of the remaining lines can be corrected with
18+
other cops such as `IndentationConsistency` and `EndAlignment`.

0 commit comments

Comments
 (0)