Skip to content

Commit

Permalink
Cut 1.29
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed May 6, 2022
1 parent e6a5a94 commit 2f2b2a7
Show file tree
Hide file tree
Showing 15 changed files with 241 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ output by `rubocop -V`, include them as well. Here's an example:

```
$ [bundle exec] rubocop -V
1.28.2 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
1.29.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
- rubocop-performance 1.9.1
- rubocop-rspec 2.0.0
```
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## master (unreleased)

## 1.29.0 (2022-05-06)

### New features

* [#10570](https://github.com/rubocop/rubocop/issues/10570): Add new `Gemspec/DependencyVersion` cop. ([@nobuyo][])
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ do so.

```
$ rubocop -V
1.28.2 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
1.29.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
- rubocop-performance 1.9.1
- rubocop-rspec 2.0.0
```
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
in your `Gemfile`:

```rb
gem 'rubocop', '~> 1.28', require: false
gem 'rubocop', '~> 1.29', require: false
```

See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
Expand Down
4 changes: 2 additions & 2 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Gemspec/DateAssignment:
Gemspec/DependencyVersion:
Description: 'Requires or forbids specifying gem dependency versions.'
Enabled: false
VersionAdded: '<<next>>'
VersionAdded: '1.29'
EnforcedStyle: 'required'
SupportedStyles:
- 'required'
Expand Down Expand Up @@ -3508,7 +3508,7 @@ Style/EnvHome:
Description: "Checks for consistent usage of `ENV['HOME']`."
Enabled: pending
Safe: false
VersionAdded: '<<next>>'
VersionAdded: '1.29'

Style/EvalWithLocation:
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: rubocop
title: RuboCop
# We always provide version without patch here (e.g. 1.1),
# as patch versions should not appear in the docs.
version: ~
version: '1.29'
nav:
- modules/ROOT/nav.adoc
3 changes: 2 additions & 1 deletion docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ In the following section you find all available cops:
=== Department xref:cops_gemspec.adoc[Gemspec]

* xref:cops_gemspec.adoc#gemspecdateassignment[Gemspec/DateAssignment]
* xref:cops_gemspec.adoc#gemspecdependencyversion[Gemspec/DependencyVersion]
* xref:cops_gemspec.adoc#gemspecduplicatedassignment[Gemspec/DuplicatedAssignment]
* xref:cops_gemspec.adoc#gemspecordereddependencies[Gemspec/OrderedDependencies]
* xref:cops_gemspec.adoc#gemspecrequiremfa[Gemspec/RequireMFA]
Expand Down Expand Up @@ -311,7 +312,6 @@ In the following section you find all available cops:
* xref:cops_lint.adoc#linturiregexp[Lint/UriRegexp]
* xref:cops_lint.adoc#lintuselessaccessmodifier[Lint/UselessAccessModifier]
* xref:cops_lint.adoc#lintuselessassignment[Lint/UselessAssignment]
* xref:cops_lint.adoc#lintuselesselsewithoutrescue[Lint/UselessElseWithoutRescue]
* xref:cops_lint.adoc#lintuselessmethoddefinition[Lint/UselessMethodDefinition]
* xref:cops_lint.adoc#lintuselessruby2keywords[Lint/UselessRuby2Keywords]
* xref:cops_lint.adoc#lintuselesssettercall[Lint/UselessSetterCall]
Expand Down Expand Up @@ -422,6 +422,7 @@ In the following section you find all available cops:
* xref:cops_style.adoc#styleencoding[Style/Encoding]
* xref:cops_style.adoc#styleendblock[Style/EndBlock]
* xref:cops_style.adoc#styleendlessmethod[Style/EndlessMethod]
* xref:cops_style.adoc#styleenvhome[Style/EnvHome]
* xref:cops_style.adoc#styleevalwithlocation[Style/EvalWithLocation]
* xref:cops_style.adoc#styleevenodd[Style/EvenOdd]
* xref:cops_style.adoc#styleexpandpatharguments[Style/ExpandPathArguments]
Expand Down
87 changes: 86 additions & 1 deletion docs/modules/ROOT/pages/cops_gemspec.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,91 @@ end
| Array
|===

== Gemspec/DependencyVersion

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Disabled
| Yes
| No
| 1.29
| -
|===

Enforce that gem dependency version specifications or a commit reference (branch,
ref, or tag) are either required or forbidden.

=== Examples

==== EnforcedStyle: required (default)

[source,ruby]
----
# bad
Gem::Specification.new do |spec|
spec.add_dependency 'parser'
end
# bad
Gem::Specification.new do |spec|
spec.add_development_dependency 'parser'
end
# good
Gem::Specification.new do |spec|
spec.add_dependency 'parser', '>= 2.3.3.1', '< 3.0'
end
# good
Gem::Specification.new do |spec|
spec.add_development_dependency 'parser', '>= 2.3.3.1', '< 3.0'
end
----

==== EnforcedStyle: forbidden

[source,ruby]
----
# bad
Gem::Specification.new do |spec|
spec.add_dependency 'parser', '>= 2.3.3.1', '< 3.0'
end
# bad
Gem::Specification.new do |spec|
spec.add_development_dependency 'parser', '>= 2.3.3.1', '< 3.0'
end
# good
Gem::Specification.new do |spec|
spec.add_dependency 'parser'
end
# good
Gem::Specification.new do |spec|
spec.add_development_dependency 'parser'
end
----

=== Configurable attributes

|===
| Name | Default value | Configurable values

| EnforcedStyle
| `required`
| `required`, `forbidden`

| Include
| `+**/*.gemspec+`
| Array

| AllowedGems
| `[]`
| Array
|===

== Gemspec/DuplicatedAssignment

|===
Expand Down Expand Up @@ -368,7 +453,7 @@ to execute `rake release` and not user's ruby version.
----
# bad
Gem::Specification.new do |spec|
if RUBY_VERSION >= '2.5'
if RUBY_VERSION >= '3.0'
spec.add_runtime_dependency 'gem_a'
else
spec.add_runtime_dependency 'gem_b'
Expand Down
57 changes: 6 additions & 51 deletions docs/modules/ROOT/pages/cops_lint.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ a * b / c % d

This cop checks for ambiguous ranges.

Ranges have quite low precedence, which leads to unexpected behaviour when
Ranges have quite low precedence, which leads to unexpected behavior when
using a range with other operators. This cop avoids that by making ranges
explicit by requiring parenthesis around complex range boundaries (anything
that is not a literal: numerics, strings, symbols, etc.).
Expand All @@ -205,7 +205,7 @@ value, it will be wrapped in order to prevent the ambiguity of `1..2.to_a`.
The cop auto-corrects by wrapping the entire boundary in parentheses, which
makes the outcome more explicit but is possible to not be the intention of the
programmer. For this reason, this cop's auto-correct is unsafe (it will not
change the behaviour of the code, but will not necessarily match the
change the behavior of the code, but will not necessarily match the
intent of the program).

=== Examples
Expand Down Expand Up @@ -2183,8 +2183,6 @@ end

== Lint/ErbNewArguments

NOTE: Required Ruby version: 2.6

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

Expand Down Expand Up @@ -2912,7 +2910,7 @@ This cop checks for uses of `begin...end while/until something`.

=== Safety

The cop is unsafe because behaviour can change in some cases, including
The cop is unsafe because behavior can change in some cases, including
if a local variable inside the loop body is accessed outside of it, or if the
loop body raises a `StopIteration` exception (which `Kernel#loop` rescues).

Expand Down Expand Up @@ -3376,7 +3374,7 @@ NOTE: This cop will be deprecated and removed when supporting only Ruby 3.0 and
=== Safety

This cop is unsafe in the case where sorting files changes existing
expected behaviour.
expected behavior.

=== Examples

Expand Down Expand Up @@ -3616,7 +3614,7 @@ locations, the result may vary depending on the order of `require`.
=== Safety

This cop is unsafe because code that is already conditionally
assigning a constant may have its behaviour changed by
assigning a constant may have its behavior changed by
auto-correction.

=== Examples
Expand Down Expand Up @@ -3853,7 +3851,7 @@ name with an explicit namespace.
=== Safety

This cop is unsafe because it will change the exception class being
raised, which is a change in behaviour.
raised, which is a change in behavior.

=== Examples

Expand Down Expand Up @@ -6443,49 +6441,6 @@ end

* https://rubystyle.guide#underscore-unused-vars

== Lint/UselessElseWithoutRescue

|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Enabled
| Yes
| No
| 0.17
| -
|===

This cop checks for useless `else` in `begin..end` without `rescue`.

NOTE: This syntax is no longer valid on Ruby 2.6 or higher and
this cop is going to be removed at some point the future.

=== Examples

[source,ruby]
----
# bad
begin
do_something
else
do_something_else # This will never be run.
end
----

[source,ruby]
----
# good
begin
do_something
rescue
handle_errors
else
do_something_else
end
----

== Lint/UselessMethodDefinition

|===
Expand Down
24 changes: 24 additions & 0 deletions docs/modules/ROOT/pages/cops_naming.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,14 @@ foo_bar = 1
fooBar = 1
----

==== AllowedPatterns: ['_v\d+\z']

[source,ruby]
----
# good
:release_v1
----

=== Configurable attributes

|===
Expand All @@ -1272,6 +1280,10 @@ fooBar = 1
| AllowedIdentifiers
| `[]`
| Array

| AllowedPatterns
| `[]`
| Array
|===

=== References
Expand Down Expand Up @@ -1417,6 +1429,14 @@ def some_method_1; end
expect(Open3).to receive(:capture3)
----

==== AllowedPatterns: ['_v\d+\z']

[source,ruby]
----
# good
:some_sym_v1
----

=== Configurable attributes

|===
Expand All @@ -1437,6 +1457,10 @@ expect(Open3).to receive(:capture3)
| AllowedIdentifiers
| `capture3`, `iso8601`, `rfc1123_date`, `rfc822`, `rfc2822`, `rfc3339`
| Array

| AllowedPatterns
| `[]`
| Array
|===

=== References
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/cops_security.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ NOTE: Ruby 3.1+ (Psych 4) uses `Psych.load` as `Psych.safe_load` by default.

=== Safety

The behaviour of the code might change depending on what was
The behavior of the code might change depending on what was
in the YAML payload, since `YAML.safe_load` is more restrictive.

=== Examples
Expand Down

0 comments on commit 2f2b2a7

Please sign in to comment.