Skip to content

Commit

Permalink
Cut 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Jun 1, 2021
1 parent 31e2bd2 commit 68cd82e
Show file tree
Hide file tree
Showing 13 changed files with 319 additions and 23 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.15.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
1.16.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.16.0 (2021-06-01)

### New features

* [#9841](https://github.com/rubocop/rubocop/pull/9841): Support guard `if` and `unless` syntax keywords of Ruby 2.7's pattern matching for `Layout/SpaceAroundKeyword`. ([@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.

```
$ rubocop -V
1.15.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
1.16.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.15', require: false
gem 'rubocop', '~> 1.16', require: false
```

See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
Expand Down
18 changes: 9 additions & 9 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ Layout/CaseIndentation:
StyleGuide: '#indent-when-to-case'
Enabled: true
VersionAdded: '0.49'
VersionChanged: '<<next>>'
VersionChanged: '1.16'
EnforcedStyle: case
SupportedStyles:
- case
Expand Down Expand Up @@ -772,7 +772,7 @@ Layout/HashAlignment:
Enabled: true
AllowMultipleStyles: true
VersionAdded: '0.49'
VersionChanged: '<<next>>'
VersionChanged: '1.16'
# Alignment of entries using hash rocket as separator. Valid values are:
#
# key - left alignment of keys
Expand Down Expand Up @@ -1649,7 +1649,7 @@ Lint/EmptyFile:
Lint/EmptyInPattern:
Description: 'Checks for the presence of `in` pattern branches without a body.'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.16'

Lint/EmptyInterpolation:
Description: 'Checks for empty string interpolation.'
Expand Down Expand Up @@ -2098,7 +2098,7 @@ Lint/SymbolConversion:
Description: 'Checks for unnecessary symbol conversions.'
Enabled: pending
VersionAdded: '1.9'
VersionChanged: '<<next>>'
VersionChanged: '1.16'
EnforcedStyle: strict
SupportedStyles:
- strict
Expand Down Expand Up @@ -3499,7 +3499,7 @@ Style/HashEachMethods:
Enabled: true
Safe: false
VersionAdded: '0.80'
VersionChanged: <<next>>
VersionChanged: '1.16'
AllowedReceivers: []

Style/HashExcept:
Expand Down Expand Up @@ -3563,7 +3563,7 @@ Style/IdenticalConditionalBranches:
out of the conditional.
Enabled: true
VersionAdded: '0.36'
VersionChanged: <<next>>
VersionChanged: '1.16'

Style/IfInsideElse:
Description: 'Finds if nodes inside else, which can be converted to elsif.'
Expand Down Expand Up @@ -3614,7 +3614,7 @@ Style/InPatternThen:
Description: 'Checks for `in;` uses in `case` expressions.'
StyleGuide: '#no-in-pattern-semicolons'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.16'

Style/InfiniteLoop:
Description: >-
Expand Down Expand Up @@ -3848,7 +3848,7 @@ Style/MultilineInPatternThen:
Description: 'Do not use `then` for multi-line `in` statement.'
StyleGuide: '#no-then'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.16'

Style/MultilineMemoization:
Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
Expand Down Expand Up @@ -4211,7 +4211,7 @@ Style/Proc:
Style/QuotedSymbols:
Description: 'Use a consistent style for quoted symbols.'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.16'
EnforcedStyle: same_as_string_literals
SupportedStyles:
- same_as_string_literals
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.16'
nav:
- modules/ROOT/nav.adoc
4 changes: 4 additions & 0 deletions docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ In the following section you find all available cops:
* xref:cops_lint.adoc#lintemptyensure[Lint/EmptyEnsure]
* xref:cops_lint.adoc#lintemptyexpression[Lint/EmptyExpression]
* xref:cops_lint.adoc#lintemptyfile[Lint/EmptyFile]
* xref:cops_lint.adoc#lintemptyinpattern[Lint/EmptyInPattern]
* xref:cops_lint.adoc#lintemptyinterpolation[Lint/EmptyInterpolation]
* xref:cops_lint.adoc#lintemptywhen[Lint/EmptyWhen]
* xref:cops_lint.adoc#lintensurereturn[Lint/EnsureReturn]
Expand Down Expand Up @@ -436,6 +437,7 @@ In the following section you find all available cops:
* xref:cops_style.adoc#styleifwithbooleanliteralbranches[Style/IfWithBooleanLiteralBranches]
* xref:cops_style.adoc#styleifwithsemicolon[Style/IfWithSemicolon]
* xref:cops_style.adoc#styleimplicitruntimeerror[Style/ImplicitRuntimeError]
* xref:cops_style.adoc#styleinpatternthen[Style/InPatternThen]
* xref:cops_style.adoc#styleinfiniteloop[Style/InfiniteLoop]
* xref:cops_style.adoc#styleinlinecomment[Style/InlineComment]
* xref:cops_style.adoc#styleinversemethods[Style/InverseMethods]
Expand All @@ -457,6 +459,7 @@ In the following section you find all available cops:
* xref:cops_style.adoc#stylemultilineblockchain[Style/MultilineBlockChain]
* xref:cops_style.adoc#stylemultilineifmodifier[Style/MultilineIfModifier]
* xref:cops_style.adoc#stylemultilineifthen[Style/MultilineIfThen]
* xref:cops_style.adoc#stylemultilineinpatternthen[Style/MultilineInPatternThen]
* xref:cops_style.adoc#stylemultilinememoization[Style/MultilineMemoization]
* xref:cops_style.adoc#stylemultilinemethodsignature[Style/MultilineMethodSignature]
* xref:cops_style.adoc#stylemultilineternaryoperator[Style/MultilineTernaryOperator]
Expand Down Expand Up @@ -490,6 +493,7 @@ In the following section you find all available cops:
* xref:cops_style.adoc#styleperlbackrefs[Style/PerlBackrefs]
* xref:cops_style.adoc#stylepreferredhashmethods[Style/PreferredHashMethods]
* xref:cops_style.adoc#styleproc[Style/Proc]
* xref:cops_style.adoc#stylequotedsymbols[Style/QuotedSymbols]
* xref:cops_style.adoc#styleraiseargs[Style/RaiseArgs]
* xref:cops_style.adoc#stylerandomwithoffset[Style/RandomWithOffset]
* xref:cops_style.adoc#styleredundantargument[Style/RedundantArgument]
Expand Down
50 changes: 46 additions & 4 deletions docs/modules/ROOT/pages/cops_layout.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,13 @@ blah { |i|
| Yes
| Yes
| 0.49
| -
| 1.16
|===

This cop checks how the ``when``s of a `case` expression
This cop checks how the `when` and `in`s of a `case` expression
are indented in relation to its `case` or `end` keyword.

It will register a separate offense for each misaligned `when`.
It will register a separate offense for each misaligned `when` and `in`.

=== Examples

Expand All @@ -505,13 +505,27 @@ case n
y / 3
end
case n
in pattern
x * 2
else
y / 3
end
# good for all styles
case n
when 0
x * 2
else
y / 3
end
case n
in pattern
x * 2
else
y / 3
end
----

==== EnforcedStyle: case (default)
Expand All @@ -530,13 +544,27 @@ else
y / 3
end
a = case n
in pattern
x * 2
else
y / 3
end
# good
a = case n
when 0
x * 2
else
y / 3
end
a = case n
in pattern
x * 2
else
y / 3
end
----

==== EnforcedStyle: end
Expand All @@ -551,13 +579,27 @@ a = case n
y / 3
end
a = case n
in pattern
x * 2
else
y / 3
end
# good
a = case n
when 0
x * 2
else
y / 3
end
a = case n
in pattern
x * 2
else
y / 3
end
----

=== Configurable attributes
Expand Down Expand Up @@ -3073,7 +3115,7 @@ end
| Yes
| Yes
| 0.49
| 0.77
| 1.16
|===

Check that the keys, separators, and values of a multi-line hash
Expand Down
64 changes: 63 additions & 1 deletion docs/modules/ROOT/pages/cops_lint.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1763,6 +1763,68 @@ This cop enforces that Ruby source files are not empty.
| Boolean
|===

== Lint/EmptyInPattern

NOTE: Required Ruby version: 2.7

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

| Pending
| Yes
| No
| 1.16
| -
|===

This cop checks for the presence of `in` pattern branches without a body.

=== Examples

[source,ruby]
----
# bad
case condition
in [a]
do_something
in [a, b]
end
# good
case condition
in [a]
do_something
in [a, b]
nil
end
----

==== AllowComments: true (default)

[source,ruby]
----
# good
case condition
in [a]
do_something
in [a, b]
# noop
end
----

==== AllowComments: false

[source,ruby]
----
# bad
case condition
in [a]
do_something
in [a, b]
# noop
end
----

== Lint/EmptyInterpolation

|===
Expand Down Expand Up @@ -4826,7 +4888,7 @@ do_something rescue nil
| Yes
| Yes
| 1.9
| -
| 1.16
|===

This cop checks for uses of literal strings converted to
Expand Down
Loading

0 comments on commit 68cd82e

Please sign in to comment.