Skip to content

Commit

Permalink
Cut 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Sep 13, 2021
1 parent 4593883 commit 25112e6
Show file tree
Hide file tree
Showing 15 changed files with 142 additions and 41 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.20.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
1.21.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.21.0 (2021-09-13)

### New features

* [#7849](https://github.com/rubocop/rubocop/issues/7849): Add new `Lint/AmbiguousOperatorPrecedence` cop. ([@dvandersluis][])
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.20.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
1.21.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 @@ -54,7 +54,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
in your `Gemfile`:

```rb
gem 'rubocop', '~> 1.20', require: false
gem 'rubocop', '~> 1.21', require: false
```

See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
Expand Down
10 changes: 5 additions & 5 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ Lint/AmbiguousOperatorPrecedence:
Checks for expressions containing multiple binary operations with
ambiguous precedence.
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.21'

Lint/AmbiguousRange:
Description: Checks for ranges with ambiguous boundaries.
Expand Down Expand Up @@ -1780,7 +1780,7 @@ Lint/ImplicitStringConcatenation:
Lint/IncompatibleIoSelectWithFiberScheduler:
Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.21'

Lint/IneffectiveAccessModifier:
Description: >-
Expand Down Expand Up @@ -2576,7 +2576,7 @@ Naming/InclusiveLanguage:
Description: 'Recommend the use of inclusive language instead of problematic terms.'
Enabled: false
VersionAdded: '1.18'
VersionChanged: '<<next>>'
VersionChanged: '1.21'
CheckIdentifiers: true
CheckConstants: true
CheckVariables: true
Expand Down Expand Up @@ -2810,7 +2810,7 @@ Style/AndOr:
Enabled: true
SafeAutoCorrect: false
VersionAdded: '0.9'
VersionChanged: '<<next>>'
VersionChanged: '1.21'
# Whether `and` and `or` are banned only in conditionals (conditionals)
# or completely (always).
EnforcedStyle: conditionals
Expand Down Expand Up @@ -2846,7 +2846,7 @@ Style/AsciiComments:
StyleGuide: '#english-comments'
Enabled: false
VersionAdded: '0.9'
VersionChanged: '<<next>>'
VersionChanged: '1.21'
AllowedChars:
- ©

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: 'master'
version: '1.21'
nav:
- modules/ROOT/nav.adoc
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ In the following section you find all available cops:
* xref:cops_lint.adoc#lintambiguousassignment[Lint/AmbiguousAssignment]
* xref:cops_lint.adoc#lintambiguousblockassociation[Lint/AmbiguousBlockAssociation]
* xref:cops_lint.adoc#lintambiguousoperator[Lint/AmbiguousOperator]
* xref:cops_lint.adoc#lintambiguousoperatorprecedence[Lint/AmbiguousOperatorPrecedence]
* xref:cops_lint.adoc#lintambiguousrange[Lint/AmbiguousRange]
* xref:cops_lint.adoc#lintambiguousregexpliteral[Lint/AmbiguousRegexpLiteral]
* xref:cops_lint.adoc#lintassignmentincondition[Lint/AssignmentInCondition]
Expand Down Expand Up @@ -235,6 +236,7 @@ In the following section you find all available cops:
* xref:cops_lint.adoc#lintheredocmethodcallposition[Lint/HeredocMethodCallPosition]
* xref:cops_lint.adoc#lintidentitycomparison[Lint/IdentityComparison]
* xref:cops_lint.adoc#lintimplicitstringconcatenation[Lint/ImplicitStringConcatenation]
* xref:cops_lint.adoc#lintincompatibleioselectwithfiberscheduler[Lint/IncompatibleIoSelectWithFiberScheduler]
* xref:cops_lint.adoc#lintineffectiveaccessmodifier[Lint/IneffectiveAccessModifier]
* xref:cops_lint.adoc#lintinheritexception[Lint/InheritException]
* xref:cops_lint.adoc#lintinterpolationcheck[Lint/InterpolationCheck]
Expand Down
22 changes: 11 additions & 11 deletions docs/modules/ROOT/pages/cops_bundler.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -342,18 +342,18 @@ gem 'rubocop', tag: 'v1.17.0'
| -
|===

The symbol argument `:gemcutter`, `:rubygems`, and `:rubyforge`
are deprecated. So please change your source to URL string that
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Passing symbol arguments to `source` (e.g. `source :rubygems`) is
deprecated because they default to using HTTP requests. Instead, specify
`'https://rubygems.org'` if possible, or `'http://rubygems.org'` if not.

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

However, it don't replace all `sources` of `http://` with `https://`.
For example, when specifying an internal gem server using HTTP on the
intranet, a use case where HTTPS cannot be specified was considered.
Consider using HTTP only if you cannot use HTTPS.
This cop will not replace existing sources that use `http://`. This may
be necessary where HTTPS is not available. For example, where using an
internal gem server via an intranet, or where HTTPS is prohibited.
However, you should strongly prefer `https://` where possible, as it is
more secure.

=== Examples

Expand All @@ -366,7 +366,7 @@ source :rubyforge
# good
source 'https://rubygems.org' # strongly recommended
source 'http://rubygems.org'
source 'http://rubygems.org' # use only if HTTPS is unavailable
----

=== Configurable attributes
Expand Down
4 changes: 0 additions & 4 deletions docs/modules/ROOT/pages/cops_layout.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4096,10 +4096,6 @@ bar: "0000000000", baz: "0000000000"}
|===
| Name | Default value | Configurable values

| AutoCorrect
| `true`
| Boolean

| Max
| `120`
| Integer
Expand Down
72 changes: 72 additions & 0 deletions docs/modules/ROOT/pages/cops_lint.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,47 @@ do_something(*some_array)

* https://rubystyle.guide#method-invocation-parens

== Lint/AmbiguousOperatorPrecedence

|===
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged

| Pending
| Yes
| Yes
| 1.21
| -
|===

This cop looks for expressions containing multiple binary operators
where precedence is ambiguous due to lack of parentheses. For example,
in `1 + 2 * 3`, the multiplication will happen before the addition, but
lexically it appears that the addition will happen first.

The cop does not consider unary operators (ie. `!a` or `-b`) or comparison
operators (ie. `a =~ b`) because those are not ambiguous.

NOTE: Ranges are handled by `Lint/AmbiguousRange`.

=== Examples

[source,ruby]
----
# bad
a + b * c
a || b && c
a ** b + c
# good (different precedence)
a + (b * c)
a || (b && c)
(a ** b) + c
# good (same precedence)
a + b + c
a * b / c % d
----

== Lint/AmbiguousRange

|===
Expand Down Expand Up @@ -2478,6 +2519,37 @@ array = [
]
----

== Lint/IncompatibleIoSelectWithFiberScheduler

|===
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged

| Pending
| Yes
| Yes
| 1.21
| -
|===

This cop checks for `IO.select` that is incompatible with Fiber Scheduler since Ruby 3.0.

=== Examples

[source,ruby]
----
# bad
IO.select([io], [], [], timeout)
# good
io.wait_readable(timeout)
# bad
IO.select([], [io], [], timeout)
# good
io.wait_writable(timeout)
----

== Lint/IneffectiveAccessModifier

|===
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/cops_naming.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,11 @@ EOS
|===
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged

| Pending
| Disabled
| Yes
| No
| 1.18
| -
| 1.21
|===

This cops recommends the use of inclusive language instead of problematic terms.
Expand Down
31 changes: 18 additions & 13 deletions docs/modules/ROOT/pages/cops_style.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,19 @@ alias_method :bar, :foo

| Enabled
| Yes
| Yes
| Yes (Unsafe)
| 0.9
| 0.25
| 1.21
|===

This cop checks for uses of `and` and `or`, and suggests using `&&` and
`||` instead. It can be configured to check only in conditions or in
all contexts.

It is marked as unsafe auto-correction because it may change the
operator precedence between logical operators (`&&` and `||`) and
semantic operators (`and` and `or`).

=== Examples

==== EnforcedStyle: always
Expand Down Expand Up @@ -443,11 +447,11 @@ array literal or the second is a string literal.
|===
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged

| Enabled
| Disabled
| Yes
| No
| 0.9
| 0.52
| 1.21
|===

This cop checks for non-ascii (non-English) characters
Expand Down Expand Up @@ -914,12 +918,14 @@ end

This cop checks for uses of the case equality operator(===).

If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
the case equality operator is a constant.

=== Examples

[source,ruby]
----
# bad
Array === something
(1..100) === 7
/something/ === some_string
Expand All @@ -929,21 +935,20 @@ something.is_a?(Array)
/something/.match?(some_string)
----

==== AllowOnConstant
==== AllowOnConstant: false (default)

[source,ruby]
----
# Style/CaseEquality:
# AllowOnConstant: true
# bad
(1..100) === 7
/something/ === some_string
Array === something
----

==== AllowOnConstant: true

[source,ruby]
----
# good
Array === something
(1..100).include?(7)
/something/.match?(some_string)
----

=== Configurable attributes
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/installation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ in your `Gemfile`:

[source,rb]
----
gem 'rubocop', '~> 1.20', require: false
gem 'rubocop', '~> 1.21', require: false
----

NOTE: You can check out our progress on the road to version 1.0 https://github.com/rubocop/rubocop/milestone/4[here].
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module RuboCop
# This module holds the RuboCop version information.
module Version
STRING = '1.20.0'
STRING = '1.21.0'

MSG = '%<version>s (using Parser %<parser_version>s, '\
'rubocop-ast %<rubocop_ast_version>s, ' \
Expand Down
24 changes: 24 additions & 0 deletions relnotes/v1.21.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### New features

* [#7849](https://github.com/rubocop/rubocop/issues/7849): Add new `Lint/AmbiguousOperatorPrecedence` cop. ([@dvandersluis][])
* [#9061](https://github.com/rubocop/rubocop/issues/9061): Add new `Lint/IncompatibleIoSelectWithFiberScheduler` cop. ([@koic][])

### Bug fixes

* [#10067](https://github.com/rubocop/rubocop/pull/10067): Fix an error for `Lint/NumberConversion` when using nested number conversion methods. ([@koic][])
* [#10054](https://github.com/rubocop/rubocop/pull/10054): Fix a false positive for `Layout/SpaceAroundOperators` when match operators between `<<` and `+=`. ([@koic][])
* [#10061](https://github.com/rubocop/rubocop/issues/10061): Fix a false positive for `Style/RedundantSort` when using `size` method in the block. ([@koic][])
* [#10063](https://github.com/rubocop/rubocop/pull/10063): Fix a false positive for `Layout/SingleLineBlockChain` when method call chained on a new line after a single line block with trailing dot. ([@koic][])
* [#10064](https://github.com/rubocop/rubocop/pull/10064): Fix `Style/ExplicitBlockArgument` corrector assuming any existing block argument was named `block`. ([@byroot][])
* [#10070](https://github.com/rubocop/rubocop/issues/10070): Fix a false positive for `Style/MutableConstant` when using non-interpolated heredoc in Ruby 3.0. ([@koic][])

### Changes

* [#9674](https://github.com/rubocop/rubocop/issues/9674): Disable `Style/AsciiComments` by default. ([@dvandersluis][])
* [#10051](https://github.com/rubocop/rubocop/pull/10051): Improve the messaging for `Style/Documentation` to be more clear about what class/module needs documentation. ([@dvandersluis][])
* [#10074](https://github.com/rubocop/rubocop/pull/10074): Update `Naming/InclusiveLanguage` to be disabled by default. ([@dvandersluis][])
* [#10068](https://github.com/rubocop/rubocop/pull/10068): Mark `Style/AndOr` as unsafe auto-correction. ([@koic][])

[@dvandersluis]: https://github.com/dvandersluis
[@koic]: https://github.com/koic
[@byroot]: https://github.com/byroot

0 comments on commit 25112e6

Please sign in to comment.