Skip to content

Commit 05d66bf

Browse files
automated changes from "rake docs:scrape"
1 parent 35db219 commit 05d66bf

File tree

527 files changed

+5942
-1286
lines changed

Some content is hidden

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

527 files changed

+5942
-1286
lines changed

config/contents/bundler/duplicated_gem.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
A Gem's requirements should be listed only once in a Gemfile.
2+
23
### Example:
34
# bad
45
gem 'rubocop'
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
A Gem group, or a set of groups, should be listed only once in a Gemfile.
2+
3+
For example, if the values of `source`, `git`, `platforms`, or `path`
4+
surrounding `group` are different, no offense will be registered:
5+
6+
[source,ruby]
7+
-----
8+
platforms :ruby do
9+
group :default do
10+
gem 'openssl'
11+
end
12+
end
13+
14+
platforms :jruby do
15+
group :default do
16+
gem 'jruby-openssl'
17+
end
18+
end
19+
-----
20+
21+
### Example:
22+
# bad
23+
group :development do
24+
gem 'rubocop'
25+
end
26+
27+
group :development do
28+
gem 'rubocop-rails'
29+
end
30+
31+
# bad (same set of groups declared twice)
32+
group :development, :test do
33+
gem 'rubocop'
34+
end
35+
36+
group :test, :development do
37+
gem 'rspec'
38+
end
39+
40+
# good
41+
group :development do
42+
gem 'rubocop'
43+
end
44+
45+
group :development, :test do
46+
gem 'rspec'
47+
end
48+
49+
# good
50+
gem 'rubocop', groups: [:development, :test]
51+
gem 'rspec', groups: [:development, :test]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Verifies that a project contains Gemfile or gems.rb file and correct
2+
associated lock file based on the configuration.
3+
4+
### Example: EnforcedStyle: Gemfile (default)
5+
# bad
6+
Project contains gems.rb and gems.locked files
7+
8+
# bad
9+
Project contains Gemfile and gems.locked file
10+
11+
# good
12+
Project contains Gemfile and Gemfile.lock
13+
14+
### Example: EnforcedStyle: gems.rb
15+
# bad
16+
Project contains Gemfile and Gemfile.lock files
17+
18+
# bad
19+
Project contains gems.rb and Gemfile.lock file
20+
21+
# good
22+
Project contains gems.rb and gems.locked files
Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
The symbol argument `:gemcutter`, `:rubygems`, and `:rubyforge`
2-
are deprecated. So please change your source to URL string that
3-
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
1+
Passing symbol arguments to `source` (e.g. `source :rubygems`) is
2+
deprecated because they default to using HTTP requests. Instead, specify
3+
`'https://rubygems.org'` if possible, or `'http://rubygems.org'` if not.
44

5-
This autocorrect will replace these symbols with 'https://rubygems.org'.
6-
Because it is secure, HTTPS request is strongly recommended. And in
7-
most use cases HTTPS will be fine.
5+
When autocorrecting, this cop will replace symbol arguments with
6+
`'https://rubygems.org'`.
87

9-
However, it don't replace all `sources` of `http://` with `https://`.
10-
For example, when specifying an internal gem server using HTTP on the
11-
intranet, a use case where HTTPS cannot be specified was considered.
12-
Consider using HTTP only if you cannot use HTTPS.
8+
This cop will not replace existing sources that use `http://`. This may
9+
be necessary where HTTPS is not available. For example, where using an
10+
internal gem server via an intranet, or where HTTPS is prohibited.
11+
However, you should strongly prefer `https://` where possible, as it is
12+
more secure.
13+
14+
If you don't allow `http://`, please set `false` to `AllowHttpProtocol`.
15+
This option is `true` by default for safe autocorrection.
1316

1417
### Example:
1518
# bad
@@ -19,4 +22,13 @@ Consider using HTTP only if you cannot use HTTPS.
1922

2023
# good
2124
source 'https://rubygems.org' # strongly recommended
22-
source 'http://rubygems.org'
25+
26+
### Example: AllowHttpProtocol: true (default)
27+
28+
# good
29+
source 'http://rubygems.org' # use only if HTTPS is unavailable
30+
31+
### Example: AllowHttpProtocol: false
32+
33+
# bad
34+
source 'http://rubygems.org'

config/contents/bundler/ordered_gems.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ Gems should be alphabetically sorted within groups.
1414

1515
gem 'rspec'
1616

17-
# good only if TreatCommentsAsGroupSeparators is true
17+
### Example: TreatCommentsAsGroupSeparators: true (default)
18+
# good
19+
# For code quality
20+
gem 'rubocop'
21+
# For tests
22+
gem 'rspec'
23+
24+
### Example: TreatCommentsAsGroupSeparators: false
25+
# bad
1826
# For code quality
1927
gem 'rubocop'
2028
# For tests

config/contents/gemspec/date_assignment.md

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Enforce that gem dependency version specifications or a commit reference (branch,
2+
ref, or tag) are either required or forbidden.
3+
4+
### Example: EnforcedStyle: required (default)
5+
6+
# bad
7+
Gem::Specification.new do |spec|
8+
spec.add_dependency 'parser'
9+
end
10+
11+
# bad
12+
Gem::Specification.new do |spec|
13+
spec.add_development_dependency 'parser'
14+
end
15+
16+
# good
17+
Gem::Specification.new do |spec|
18+
spec.add_dependency 'parser', '>= 2.3.3.1', '< 3.0'
19+
end
20+
21+
# good
22+
Gem::Specification.new do |spec|
23+
spec.add_development_dependency 'parser', '>= 2.3.3.1', '< 3.0'
24+
end
25+
26+
### Example: EnforcedStyle: forbidden
27+
28+
# bad
29+
Gem::Specification.new do |spec|
30+
spec.add_dependency 'parser', '>= 2.3.3.1', '< 3.0'
31+
end
32+
33+
# bad
34+
Gem::Specification.new do |spec|
35+
spec.add_development_dependency 'parser', '>= 2.3.3.1', '< 3.0'
36+
end
37+
38+
# good
39+
Gem::Specification.new do |spec|
40+
spec.add_dependency 'parser'
41+
end
42+
43+
# good
44+
Gem::Specification.new do |spec|
45+
spec.add_development_dependency 'parser'
46+
end
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Checks that deprecated attributes are not set in a gemspec file.
2+
Removing deprecated attributes allows the user to receive smaller packed gems.
3+
4+
### Example:
5+
6+
# bad
7+
Gem::Specification.new do |spec|
8+
spec.name = 'your_cool_gem_name'
9+
spec.test_files = Dir.glob('test/**/*')
10+
end
11+
12+
# bad
13+
Gem::Specification.new do |spec|
14+
spec.name = 'your_cool_gem_name'
15+
spec.test_files += Dir.glob('test/**/*')
16+
end
17+
18+
# good
19+
Gem::Specification.new do |spec|
20+
spec.name = 'your_cool_gem_name'
21+
end
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Enforce that development dependencies for a gem are specified in
2+
`Gemfile`, rather than in the `gemspec` using
3+
`add_development_dependency`. Alternatively, using `EnforcedStyle:
4+
gemspec`, enforce that all dependencies are specified in `gemspec`,
5+
rather than in `Gemfile`.
6+
7+
### Example: EnforcedStyle: Gemfile (default)
8+
# Specify runtime dependencies in your gemspec,
9+
# but all other dependencies in your Gemfile.
10+
11+
# bad
12+
# example.gemspec
13+
s.add_development_dependency "foo"
14+
15+
# good
16+
# Gemfile
17+
gem "foo"
18+
19+
# good
20+
# gems.rb
21+
gem "foo"
22+
23+
# good (with AllowedGems: ["bar"])
24+
# example.gemspec
25+
s.add_development_dependency "bar"
26+
27+
### Example: EnforcedStyle: gems.rb
28+
# Specify runtime dependencies in your gemspec,
29+
# but all other dependencies in your Gemfile.
30+
#
31+
# Identical to `EnforcedStyle: Gemfile`, but with a different error message.
32+
# Rely on Bundler/GemFilename to enforce the use of `Gemfile` vs `gems.rb`.
33+
34+
# bad
35+
# example.gemspec
36+
s.add_development_dependency "foo"
37+
38+
# good
39+
# Gemfile
40+
gem "foo"
41+
42+
# good
43+
# gems.rb
44+
gem "foo"
45+
46+
# good (with AllowedGems: ["bar"])
47+
# example.gemspec
48+
s.add_development_dependency "bar"
49+
50+
### Example: EnforcedStyle: gemspec
51+
# Specify all dependencies in your gemspec.
52+
53+
# bad
54+
# Gemfile
55+
gem "foo"
56+
57+
# good
58+
# example.gemspec
59+
s.add_development_dependency "foo"
60+
61+
# good (with AllowedGems: ["bar"])
62+
# Gemfile
63+
gem "bar"

config/contents/gemspec/ordered_dependencies.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@ Dependencies in the gemspec should be alphabetically sorted.
4040

4141
spec.add_runtime_dependency 'rspec'
4242

43-
# good only if TreatCommentsAsGroupSeparators is true
43+
### Example: TreatCommentsAsGroupSeparators: true (default)
44+
# good
45+
# For code quality
46+
spec.add_dependency 'rubocop'
47+
# For tests
48+
spec.add_dependency 'rspec'
49+
50+
### Example: TreatCommentsAsGroupSeparators: false
51+
# bad
4452
# For code quality
4553
spec.add_dependency 'rubocop'
4654
# For tests

0 commit comments

Comments
 (0)