Skip to content

Commit

Permalink
Cut 1.50
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Apr 11, 2023
1 parent fbf9949 commit b71808e
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 15 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.49.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2) [x86_64-linux]
1.50.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 @@ -11,6 +11,8 @@

## master (unreleased)

## 1.50.0 (2023-04-11)

### New features

* [#11749](https://github.com/rubocop/rubocop/pull/11749): Add new `Lint/DuplicateMatchPattern` 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.49.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2) [x86_64-linux]
1.50.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.49', require: false
gem 'rubocop', '~> 1.50', require: false
```

See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
Expand Down
2 changes: 1 addition & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ Lint/DuplicateMagicComment:
Lint/DuplicateMatchPattern:
Description: 'Do not repeat patterns in `in` keywords.'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.50'

Lint/DuplicateMethods:
Description: 'Check for duplicate method definitions.'
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.50'
nav:
- modules/ROOT/nav.adoc
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ In the following section you find all available cops:
* xref:cops_lint.adoc#lintduplicateelsifcondition[Lint/DuplicateElsifCondition]
* xref:cops_lint.adoc#lintduplicatehashkey[Lint/DuplicateHashKey]
* xref:cops_lint.adoc#lintduplicatemagiccomment[Lint/DuplicateMagicComment]
* xref:cops_lint.adoc#lintduplicatematchpattern[Lint/DuplicateMatchPattern]
* xref:cops_lint.adoc#lintduplicatemethods[Lint/DuplicateMethods]
* xref:cops_lint.adoc#lintduplicateregexpcharacterclasselement[Lint/DuplicateRegexpCharacterClassElement]
* xref:cops_lint.adoc#lintduplicaterequire[Lint/DuplicateRequire]
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 @@ -4355,10 +4355,6 @@ preceding text by exactly one space (default) or zero spaces.
|===
| Name | Default value | Configurable values

| AutoCorrect
| `true`
| Boolean

| EnforcedStyle
| `space`
| `space`, `no_space`
Expand Down
93 changes: 92 additions & 1 deletion docs/modules/ROOT/pages/cops_lint.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,91 @@ Checks for duplicated magic comments.
# frozen_string_literal: true
----

== Lint/DuplicateMatchPattern

NOTE: Required Ruby version: 2.7

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

| Pending
| Yes
| No
| 1.50
| -
|===

Checks that there are no repeated patterns used in `in` keywords.

=== Examples

[source,ruby]
----
# bad
case x
in 'first'
do_something
in 'first'
do_something_else
end
# good
case x
in 'first'
do_something
in 'second'
do_something_else
end
# bad - repeated alternate patterns with the same conditions don't depend on the order
case x
in foo | bar
first_method
in bar | foo
second_method
end
# good
case x
in foo | bar
first_method
in bar | baz
second_method
end
# bad - repeated hash patterns with the same conditions don't depend on the order
case x
in foo: a, bar: b
first_method
in bar: b, foo: a
second_method
end
# good
case x
in foo: a, bar: b
first_method
in bar: b, baz: c
second_method
end
# bad - repeated array patterns with elements in the same order
case x
in [foo, bar]
first_method
in [foo, bar]
second_method
end
# good
case x
in [foo, bar]
first_method
in [bar, foo]
second_method
end
----

== Lint/DuplicateMethods

|===
Expand Down Expand Up @@ -4596,7 +4681,7 @@ do_something(*%w[foo bar baz])
| 0.77
|===

Checks for string conversion in string interpolation,
Checks for string conversion in string interpolation, `print`, `puts`, and `warn` arguments,
which is redundant.

=== Examples
Expand All @@ -4606,13 +4691,19 @@ which is redundant.
# bad
"result is #{something.to_s}"
print something.to_s
puts something.to_s
warn something.to_s
----

[source,ruby]
----
# good
"result is #{something}"
print something
puts something
warn something
----

=== References
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/cops_style.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4333,9 +4333,9 @@ Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.

=== Safety

This cop's autocorrection is unsafe it because `File.size`, `File.read`,
and `File.binread` raise `ENOENT` exception when there is no file
corresponding to the path, while `File.empty?` does not raise an exception.
This cop is unsafe, because `File.size`, `File.read`, and `File.binread`
raise `ENOENT` exception when there is no file corresponding to the path,
while `File.empty?` does not raise an exception.

=== Examples

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.49', require: false
gem 'rubocop', '~> 1.50', 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.49.0'
STRING = '1.50.0'

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

* [#11749](https://github.com/rubocop/rubocop/pull/11749): Add new `Lint/DuplicateMatchPattern` cop. ([@koic][])
* [#11773](https://github.com/rubocop/rubocop/pull/11773): Make `Layout/ClassStructure` aware of singleton class. ([@koic][])
* [#11779](https://github.com/rubocop/rubocop/pull/11779): Make `Lint/RedundantStringCoercion` aware of print method arguments. ([@koic][])
* [#11776](https://github.com/rubocop/rubocop/pull/11776): Make `Metrics/ClassLength` aware of singleton class. ([@koic][])
* [#11775](https://github.com/rubocop/rubocop/pull/11775): Make `Style/TrailingBodyOnClass` aware of singleton class. ([@koic][])

### Bug fixes

* [#11758](https://github.com/rubocop/rubocop/issues/11758): Fix a false positive for `Style/RedundantLineContinuation` when line continuations for string. ([@koic][])
* [#11754](https://github.com/rubocop/rubocop/pull/11754): Fix a false positive for `Style/RedundantLineContinuation` when using `&&` and `||` with a multiline condition. ([@ydah][])
* [#11765](https://github.com/rubocop/rubocop/issues/11765): Fix an error for `Style/MultilineMethodSignature` when line break after `def` keyword. ([@koic][])
* [#11762](https://github.com/rubocop/rubocop/issues/11762): Fix an incorrect autocorrect for `Style/ClassEqualityComparison` when comparing a variable or return value for equality. ([@koic][])
* [#11752](https://github.com/rubocop/rubocop/pull/11752): Fix a false positive for `Style/RedundantLineContinuation` when using line concatenation and calling a method without parentheses. ([@koic][])

[@koic]: https://github.com/koic
[@ydah]: https://github.com/ydah

0 comments on commit b71808e

Please sign in to comment.