Skip to content

Commit

Permalink
Cut 1.60
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Jan 15, 2024
1 parent 84ee480 commit 56e88bb
Show file tree
Hide file tree
Showing 17 changed files with 175 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Expand Up @@ -38,7 +38,7 @@ output by `rubocop -V`, include them as well. Here's an example:

```
$ [bundle exec] rubocop -V
1.59.0 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.2.2) [x86_64-linux]
1.60.0 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.2.2) [x86_64-linux]
- rubocop-performance 1.18.0
- rubocop-rspec 2.23.2
```
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,8 @@

## master (unreleased)

## 1.60.0 (2024-01-15)

### Bug fixes

* [#12603](https://github.com/rubocop/rubocop/issues/12603): Fix an infinite loop error for `Style/MultilineTernaryOperator` when using a method call as a ternary operator condition with a line break between receiver and method. ([@koic][])
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -17,7 +17,7 @@ do so.

```console
$ rubocop -V
1.59.0 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.2.2) [x86_64-linux]
1.60.0 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 3.2.2) [x86_64-linux]
- rubocop-performance 1.18.0
- rubocop-rspec 2.23.2
```
Expand Down
2 changes: 1 addition & 1 deletion README.md
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.59', require: false
gem 'rubocop', '~> 1.60', require: false
```

See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
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.60'
nav:
- modules/ROOT/nav.adoc
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/cops_bundler.adoc
@@ -1,3 +1,9 @@
////
Do NOT edit this file by hand directly, as it is automatically generated.

Please make any necessary changes to the cop documentation within the source files themselves.
////
= Bundler
== Bundler/DuplicatedGem
Expand Down
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/cops_gemspec.adoc
@@ -1,3 +1,9 @@
////
Do NOT edit this file by hand directly, as it is automatically generated.

Please make any necessary changes to the cop documentation within the source files themselves.
////
= Gemspec
== Gemspec/DependencyVersion
Expand Down
11 changes: 10 additions & 1 deletion docs/modules/ROOT/pages/cops_layout.adoc
@@ -1,3 +1,9 @@
////
Do NOT edit this file by hand directly, as it is automatically generated.

Please make any necessary changes to the cop documentation within the source files themselves.
////
= Layout
== Layout/AccessModifierIndentation
Expand Down Expand Up @@ -2767,7 +2773,10 @@ second_param
Checks the indentation of the first element in an array literal
where the opening bracket and the first element are on separate lines.
The other elements' indentations are handled by the ArrayAlignment cop.
The other elements' indentations are handled by `Layout/ArrayAlignment` cop.
This cop will respect `Layout/ArrayAlignment` and will not work when
`EnforcedStyle: with_fixed_indentation` is specified for `Layout/ArrayAlignment`.
By default, array literals that are arguments in a method call with
parentheses, and where the opening square bracket of the array is on the
Expand Down
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/cops_lint.adoc
@@ -1,3 +1,9 @@
////
Do NOT edit this file by hand directly, as it is automatically generated.

Please make any necessary changes to the cop documentation within the source files themselves.
////
= Lint
== Lint/AmbiguousAssignment
Expand Down
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/cops_metrics.adoc
@@ -1,3 +1,9 @@
////
Do NOT edit this file by hand directly, as it is automatically generated.

Please make any necessary changes to the cop documentation within the source files themselves.
////
= Metrics
== Metrics/AbcSize
Expand Down
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/cops_migration.adoc
@@ -1,3 +1,9 @@
////
Do NOT edit this file by hand directly, as it is automatically generated.

Please make any necessary changes to the cop documentation within the source files themselves.
////
= Migration
== Migration/DepartmentName
Expand Down
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/cops_naming.adoc
@@ -1,3 +1,9 @@
////
Do NOT edit this file by hand directly, as it is automatically generated.

Please make any necessary changes to the cop documentation within the source files themselves.
////
= Naming
== Naming/AccessorMethodName
Expand Down
8 changes: 7 additions & 1 deletion docs/modules/ROOT/pages/cops_security.adoc
@@ -1,3 +1,9 @@
////
Do NOT edit this file by hand directly, as it is automatically generated.

Please make any necessary changes to the cop documentation within the source files themselves.
////
= Security
== Security/CompoundHash
Expand Down Expand Up @@ -217,6 +223,7 @@ in a class and then used without a receiver in that class.
# bad
open(something)
open("| #{something}")
open("| foo")
URI.open(something)
# good
Expand All @@ -226,7 +233,6 @@ URI.parse(something).open
# good (literal strings)
open("foo.text")
open("| foo")
URI.open("http://example.com")
----
Expand Down
75 changes: 71 additions & 4 deletions docs/modules/ROOT/pages/cops_style.adoc
@@ -1,3 +1,9 @@
////
Do NOT edit this file by hand directly, as it is automatically generated.

Please make any necessary changes to the cop documentation within the source files themselves.
////
= Style
== Style/AccessModifierDeclarations
Expand Down Expand Up @@ -10192,6 +10198,10 @@ end
| Array
|===
=== References
* https://rubystyle.guide#keyword-arguments-vs-option-hashes
== Style/OptionalArguments
|===
Expand Down Expand Up @@ -13770,8 +13780,9 @@ NOTE: Required Ruby version: 2.6
| -
|===
Checks that arrays are sliced with endless ranges instead of
`ary[start..-1]` on Ruby 2.6+.
Checks that arrays are not sliced with the redundant `ary[0..-1]`, replacing it with `ary`,
and ensures arrays are sliced with endless ranges instead of `ary[start..-1]` on Ruby 2.6+,
and with beginless ranges instead of `ary[nil..end]` on Ruby 2.7+.
=== Safety
Expand All @@ -13792,12 +13803,32 @@ sum[-3..] # Hangs forever
[source,ruby]
----
# bad
items[1..-1]
items[0..-1]
items[0..nil]
items[0...nil]
# good
items
# bad
items[1..-1] # Ruby 2.6+
items[1..nil] # Ruby 2.6+
# good
items[1..]
items[1..] # Ruby 2.6+
# bad
items[nil..42] # Ruby 2.7+
# good
items[..42] # Ruby 2.7+
items[0..42] # Ruby 2.7+
----
=== References
* https://rubystyle.guide#slicing-with-ranges
== Style/SoleNestedConditional
|===
Expand Down Expand Up @@ -14759,6 +14790,42 @@ call(&:bar)
# ArgumentError: wrong number of arguments (given 1, expected 0)
----
It is also unsafe because `Symbol#to_proc` does not work with
`protected` methods which would otherwise be accessible.
For example:
[source,ruby]
----
class Box
def initialize
@secret = rand
end
def normal_matches?(*others)
others.map { |other| other.secret }.any?(secret)
end
def symbol_to_proc_matches?(*others)
others.map(&:secret).any?(secret)
end
protected
attr_reader :secret
end
boxes = [Box.new, Box.new]
Box.new.normal_matches?(*boxes)
# => false
boxes.first.normal_matches?(*boxes)
# => true
Box.new.symbol_to_proc_matches?(*boxes)
# => NoMethodError: protected method `secret' called for #<Box...>
boxes.first.symbol_to_proc_matches?(*boxes)
# => NoMethodError: protected method `secret' called for #<Box...>
----
=== Examples
[source,ruby]
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/installation.adoc
Expand Up @@ -22,7 +22,7 @@ in your `Gemfile`:

[source,rb]
----
gem 'rubocop', '~> 1.59', require: false
gem 'rubocop', '~> 1.60', require: false
----

.A Modular RuboCop
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/version.rb
Expand Up @@ -3,7 +3,7 @@
module RuboCop
# This module holds the RuboCop version information.
module Version
STRING = '1.59.0'
STRING = '1.60.0'

MSG = '%<version>s (using Parser %<parser_version>s, ' \
'rubocop-ast %<rubocop_ast_version>s, ' \
Expand Down
43 changes: 43 additions & 0 deletions relnotes/v1.60.0.md
@@ -0,0 +1,43 @@
### Bug fixes

* [#12603](https://github.com/rubocop/rubocop/issues/12603): Fix an infinite loop error for `Style/MultilineTernaryOperator` when using a method call as a ternary operator condition with a line break between receiver and method. ([@koic][])
* [#12549](https://github.com/rubocop/rubocop/issues/12549): Fix a false positive for `Style/RedundantLineContinuation` when line continuations for multiline leading dot method chain with a blank line. ([@koic][])
* [#12610](https://github.com/rubocop/rubocop/pull/12610): Accept parentheses in argument calls with blocks for `Style/MethodCallWithArgsParentheses` `omit_parentheses` style. ([@gsamokovarov][])
* [#12580](https://github.com/rubocop/rubocop/pull/12580): Fix an infinite loop error for `Layout/EndAlignment` when misaligned in singleton class assignments with `EnforcedStyleAlignWith: variable`. ([@koic][])
* [#12548](https://github.com/rubocop/rubocop/issues/12548): Fix an infinite loop error for `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArrayAlignment`. ([@koic][])
* [#12236](https://github.com/rubocop/rubocop/issues/12236): Fix an error for `Lint/ShadowedArgument` when self assigning to a block argument in `for`. ([@koic][])
* [#12569](https://github.com/rubocop/rubocop/issues/12569): Fix an error for `Style/IdenticalConditionalBranches` when using `if`...`else` with identical leading lines that assign to `self.foo`. ([@koic][])
* [#12437](https://github.com/rubocop/rubocop/issues/12437): Fix an infinite loop error for `EnforcedStyle: omit_parentheses` of `Style/MethodCallWithArgsParentheses` with `Style/SuperWithArgsParentheses`. ([@koic][])
* [#12558](https://github.com/rubocop/rubocop/issues/12558): Fix an incorrect autocorrect for `Style/MapToHash` when using `map.to_h` without receiver. ([@koic][])
* [#12179](https://github.com/rubocop/rubocop/issues/12179): Let `--auto-gen-config` generate `Exclude` when `Max` is overridden. ([@jonas054][])
* [#12574](https://github.com/rubocop/rubocop/issues/12574): Fix bug for unrecognized style in --auto-gen-config. ([@jonas054][])
* [#12542](https://github.com/rubocop/rubocop/issues/12542): Fix false positive for `Lint/MixedRegexpCaptureTypes` when using look-ahead matcher. ([@marocchino][])
* [#12607](https://github.com/rubocop/rubocop/pull/12607): Fix a false positive for `Style/RedundantParentheses` when regexp literal attempts to match against a parenthesized condition. ([@koic][])
* [#12539](https://github.com/rubocop/rubocop/pull/12539): Fix false positives for `Lint/LiteralAssignmentInCondition` when a collection literal contains non-literal elements. ([@koic][])
* [#12571](https://github.com/rubocop/rubocop/issues/12571): Fix false positives for `Naming/BlockForwarding` when using explicit block forwarding in block method. ([@koic][])
* [#12537](https://github.com/rubocop/rubocop/issues/12537): Fix false positives for `Style/RedundantParentheses` when `AllowInMultilineConditions: true` of `Style/ParenthesesAroundCondition`. ([@koic][])
* [#12578](https://github.com/rubocop/rubocop/pull/12578): Fix false positives for `Style/ArgumentsForwarding` when rest arguments forwarding to a method in block. ([@koic][])
* [#12540](https://github.com/rubocop/rubocop/issues/12540): Fix false positives for `Style/HashEachMethods` when rest block argument of `Enumerable#each` method is used. ([@koic][])
* [#12529](https://github.com/rubocop/rubocop/issues/12529): Fix false positives for `Style/ParenthesesAroundCondition`. ([@koic][])
* [#12556](https://github.com/rubocop/rubocop/issues/12556): Fix false positives for `Style/RedundantParentheses` when parentheses are used around a semantic operator in expressions within assignments. ([@koic][])
* [#12541](https://github.com/rubocop/rubocop/pull/12541): Fix false negative in `Style/ArgumentsForwarding` when a block is forwarded but other args aren't. ([@dvandersluis][])
* [#12581](https://github.com/rubocop/rubocop/pull/12581): Handle trailing line continuation in `Layout/LineContinuationLeadingSpace`. ([@eugeneius][])
* [#12601](https://github.com/rubocop/rubocop/issues/12601): Make `Style/EachForSimpleLoop` accept block with no parameters. ([@koic][])

### Changes

* [#12535](https://github.com/rubocop/rubocop/pull/12535): Allow --autocorrect with --display-only-fail-level-offenses. ([@naveg][])
* [#12572](https://github.com/rubocop/rubocop/pull/12572): Follow a Ruby 3.3 warning for `Security/Open` when `open` with a literal string starting with a pipe. ([@koic][])
* [#12453](https://github.com/rubocop/rubocop/issues/12453): Make `Style/RedundantEach` aware of safe navigation operator. ([@koic][])
* [#12233](https://github.com/rubocop/rubocop/issues/12233): Make `Style/SlicingWithRange` aware of redundant and beginless range. ([@koic][])
* [#12388](https://github.com/rubocop/rubocop/pull/12388): Reject additional 'expanded' `EnforcedStyle` options when `--no-auto-gen-enforced-style` is given. ([@kpost][])
* [#12593](https://github.com/rubocop/rubocop/pull/12593): Require Parser 3.3.0.2 or higher. ([@koic][])

[@koic]: https://github.com/koic
[@gsamokovarov]: https://github.com/gsamokovarov
[@jonas054]: https://github.com/jonas054
[@marocchino]: https://github.com/marocchino
[@dvandersluis]: https://github.com/dvandersluis
[@eugeneius]: https://github.com/eugeneius
[@naveg]: https://github.com/naveg
[@kpost]: https://github.com/kpost

0 comments on commit 56e88bb

Please sign in to comment.