Skip to content

Commit

Permalink
Cut 1.41
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Dec 20, 2022
1 parent 5545762 commit 19d8feb
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 10 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.40.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2) [x86_64-linux]
1.41.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.41.0 (2022-12-20)

### New features

* [#11305](https://github.com/rubocop/rubocop/pull/11305): Add new `Style/RedundantDoubleSplatHashBraces` cop. ([@koic][])
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.

```console
$ rubocop -V
1.40.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2) [x86_64-linux]
1.41.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.40', require: false
gem 'rubocop', '~> 1.41', 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 @@ -3429,7 +3429,7 @@ Style/CommentedKeyword:
Style/ConcatArrayLiterals:
Description: 'Enforces the use of `Array#push(item)` instead of `Array#concat([item])` to avoid redundant array literals.'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.41'

Style/ConditionalAssignment:
Description: >-
Expand Down Expand Up @@ -4747,7 +4747,7 @@ Style/RedundantConstantBase:
Style/RedundantDoubleSplatHashBraces:
Description: 'Checks for redundant uses of double splat hash braces.'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.41'

Style/RedundantEach:
Description: 'Checks for redundant `each`.'
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.41'
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 @@ -411,6 +411,7 @@ In the following section you find all available cops:
* xref:cops_style.adoc#stylecommandliteral[Style/CommandLiteral]
* xref:cops_style.adoc#stylecommentannotation[Style/CommentAnnotation]
* xref:cops_style.adoc#stylecommentedkeyword[Style/CommentedKeyword]
* xref:cops_style.adoc#styleconcatarrayliterals[Style/ConcatArrayLiterals]
* xref:cops_style.adoc#styleconditionalassignment[Style/ConditionalAssignment]
* xref:cops_style.adoc#styleconstantvisibility[Style/ConstantVisibility]
* xref:cops_style.adoc#stylecopyright[Style/Copyright]
Expand Down Expand Up @@ -542,6 +543,7 @@ In the following section you find all available cops:
* xref:cops_style.adoc#styleredundantcondition[Style/RedundantCondition]
* xref:cops_style.adoc#styleredundantconditional[Style/RedundantConditional]
* xref:cops_style.adoc#styleredundantconstantbase[Style/RedundantConstantBase]
* xref:cops_style.adoc#styleredundantdoublesplathashbraces[Style/RedundantDoubleSplatHashBraces]
* xref:cops_style.adoc#styleredundanteach[Style/RedundantEach]
* xref:cops_style.adoc#styleredundantexception[Style/RedundantException]
* xref:cops_style.adoc#styleredundantfetchblock[Style/RedundantFetchBlock]
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/ROOT/pages/cops_lint.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,10 @@ are problematic because of a conflict with a library or just internally
using the same name a namespace and a class. To avoid too many unnecessary
offenses, Enable this cop with `Only: [The, Constant, Names, Causing, Issues]`

NOTE: `Style/RedundantConstantBase` cop is disabled if this cop is enabled to prevent
conflicting rules. Because it respects user configurations that want to enable
this cop which is disabled by default.

=== Examples

[source,ruby]
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/cops_metrics.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ The maximum level of nesting allowed is configurable.
| 0.87
|===

Checks if the length a class exceeds some maximum value.
Checks if the length of a class exceeds some maximum value.
Comment lines can optionally be ignored.
The maximum allowed length is configurable.

Expand Down Expand Up @@ -446,7 +446,7 @@ end # 6 points
| 0.87
|===

Checks if the length a module exceeds some maximum value.
Checks if the length of a module exceeds some maximum value.
Comment lines can optionally be ignored.
The maximum allowed length is configurable.

Expand Down
90 changes: 90 additions & 0 deletions docs/modules/ROOT/pages/cops_style.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2152,6 +2152,41 @@ class X # :nodoc:
end
----

== Style/ConcatArrayLiterals

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

| Pending
| Yes
| Yes
| 1.41
| -
|===

Enforces the use of `Array#push(item)` instead of `Array#concat([item])`
to avoid redundant array literals.

=== Safety

This cop is unsafe, as it can produce false positives if the receiver
is not an `Array` object.

=== Examples

[source,ruby]
----
# bad
list.concat([foo])
list.concat([bar, baz])
list.concat([qux, quux], [corge])
# good
list.push(foo)
list.push(bar, baz)
list.push(qux, quux, corge)
----

== Style/ConditionalAssignment

|===
Expand Down Expand Up @@ -10523,6 +10558,10 @@ understand from the code whether the `::` is intended or not. Where `Module.nest
is empty, there is no need to prepend `::`, so it would be nice to consistently
avoid such meaningless `::` prefix to avoid confusion.

NOTE: This cop is disabled if `Lint/ConstantResolution` cop is enabled to prevent
conflicting rules. Because it respects user configurations that want to enable
`Lint/ConstantResolution` cop which is disabled by default.

=== Examples

[source,ruby]
Expand Down Expand Up @@ -10554,6 +10593,31 @@ module A
end
----

== Style/RedundantDoubleSplatHashBraces

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

| Pending
| Yes
| Yes
| 1.41
| -
|===

Checks for redundant uses of double splat hash braces.

=== Examples

[source,ruby]
----
# bad
do_something(**{foo: bar, baz: qux})
# good
do_something(foo: bar, baz: qux)
----

== Style/RedundantEach

|===
Expand Down Expand Up @@ -11653,6 +11717,32 @@ require 'c'
require 'b'
require_relative 'c'
require 'a'
# bad
require 'a'
require 'c' if foo
require 'b'
# good
require 'a'
require 'b'
require 'c' if foo
# bad
require 'c'
if foo
require 'd'
require 'b'
end
require 'a'
# good
require 'c'
if foo
require 'b'
require 'd'
end
require 'a'
----

== Style/RescueModifier
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.40', require: false
gem 'rubocop', '~> 1.41', require: false
----

.A Modular RuboCop
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.40.0'
STRING = '1.41.0'

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

* [#11305](https://github.com/rubocop/rubocop/pull/11305): Add new `Style/RedundantDoubleSplatHashBraces` cop. ([@koic][])
* [#10812](https://github.com/rubocop/rubocop/pull/10812): New AllowMultilineFinalElement option for all LineBreaks cops. ([@Korri][])
* [#11277](https://github.com/rubocop/rubocop/issues/11277): Add new `Style/ConcatArrayLiterals` cop. ([@koic][])

### Bug fixes

* [#11255](https://github.com/rubocop/rubocop/pull/11255): Fix an error for `Style/RequireOrder` when `require` with no arguments is put between `require`. ([@ydah][])
* [#11273](https://github.com/rubocop/rubocop/issues/11273): Fix a false positive for `Lint/DuplicateMethods` when there are same `alias_method` name outside `rescue` or `ensure` scopes. ([@koic][])
* [#11267](https://github.com/rubocop/rubocop/issues/11267): Fix an error for Style/RequireOrder when modifier conditional is used between `require`. ([@ydah][])
* [#11254](https://github.com/rubocop/rubocop/pull/11254): Fix an error for `Style/RequireOrder` when `require` is a method argument. ([@koic][])
* [#11266](https://github.com/rubocop/rubocop/issues/11266): Fix a false positive for `Style/RedundantConstantBase` when enabling `Lint/ConstantResolution`. ([@koic][])
* [#11296](https://github.com/rubocop/rubocop/pull/11296): Fix an error for `Lint/NonAtomicFileOperation` when use file existence checks line break `unless` by postfix before creating file. ([@koic][])
* [#11284](https://github.com/rubocop/rubocop/issues/11284): Fix an incorrect autocorrect for `Style/WordArray` when assigning `%w()` array. ([@koic][])
* [#11299](https://github.com/rubocop/rubocop/pull/11299): Fix `base_dir` in `TargetFinder#find_files()`. ([@dukaev][])
* [#11250](https://github.com/rubocop/rubocop/pull/11250): Fix an error for `Style/GuardClause` when a method call whose last argument is not a string is in the condition body. ([@ydah][])
* [#11298](https://github.com/rubocop/rubocop/issues/11298): Fix `Lint/SafeNavigationChain` to correctly handle `[]` operator followed by save navigation and method chain. ([@fatkodima][])
* [#11256](https://github.com/rubocop/rubocop/issues/11256): Fix an incorrect autocorrect for `Style/HashSyntax` when without parentheses call expr follows after multiple keyword arguments method call. ([@koic][])
* [#11289](https://github.com/rubocop/rubocop/pull/11289): Correctly detect Rails version when using only parts of the framework, instead of the "rails" gem. ([@bdewater][])
* [#11262](https://github.com/rubocop/rubocop/pull/11262): Fix an error for `Style/IfUnlessModifier` when the body is a method call with hash splat. ([@fatkodima][])
* [#11281](https://github.com/rubocop/rubocop/pull/11281): Fix `NoMethodError` for `Style/Documentation` when a class nested under non-constant values. ([@arika][])

### Changes

* [#11306](https://github.com/rubocop/rubocop/pull/11306): Make `Style/IfWithSemicolon` aware of one line without `else` body. ([@koic][])

[@koic]: https://github.com/koic
[@Korri]: https://github.com/Korri
[@ydah]: https://github.com/ydah
[@dukaev]: https://github.com/dukaev
[@fatkodima]: https://github.com/fatkodima
[@bdewater]: https://github.com/bdewater
[@arika]: https://github.com/arika

0 comments on commit 19d8feb

Please sign in to comment.