Skip to content

Commit 7d35ef7

Browse files
committed
Cut 1.68
1 parent 3033deb commit 7d35ef7

File tree

14 files changed

+421
-23
lines changed

14 files changed

+421
-23
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ output by `rubocop -V`, include them as well. Here's an example:
3838

3939
```
4040
$ [bundle exec] rubocop -V
41-
1.67.0 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]
41+
1.68.0 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]
4242
- rubocop-performance 1.22.1
4343
- rubocop-rspec 3.1.0
4444
```

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
## master (unreleased)
1313

14+
## 1.68.0 (2024-10-31)
15+
1416
### New features
1517

1618
* [#13050](https://github.com/rubocop/rubocop/issues/13050): Add new `Style/BitwisePredicate` cop. ([@koic][])

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ do so.
1717

1818
```console
1919
$ rubocop -V
20-
1.67.0 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]
20+
1.68.0 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]
2121
- rubocop-performance 1.22.1
2222
- rubocop-rspec 3.1.0
2323
```

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
5252
in your `Gemfile`:
5353

5454
```rb
55-
gem 'rubocop', '~> 1.67', require: false
55+
gem 'rubocop', '~> 1.68', require: false
5656
```
5757

5858
See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.

config/default.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,7 @@ Lint/UnderscorePrefixedVariableName:
24602460
Lint/UnescapedBracketInRegexp:
24612461
Description: 'Checks for unescaped literal `]` in Regexp.'
24622462
Enabled: pending
2463-
VersionAdded: '<<next>>'
2463+
VersionAdded: '1.68'
24642464

24652465
Lint/UnexpectedBlockArity:
24662466
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
@@ -3154,7 +3154,7 @@ Style/AmbiguousEndlessMethodDefinition:
31543154
Description: 'Checks for endless methods inside operators of lower precedence.'
31553155
StyleGuide: '#ambiguous-endless-method-defintions'
31563156
Enabled: pending
3157-
VersionAdded: '<<next>>'
3157+
VersionAdded: '1.68'
31583158

31593159
Style/AndOr:
31603160
Description: 'Use &&/|| instead of and/or.'
@@ -3268,7 +3268,7 @@ Style/BitwisePredicate:
32683268
StyleGuide: '#bitwise-predicate-methods'
32693269
Enabled: pending
32703270
Safe: false
3271-
VersionAdded: '<<next>>'
3271+
VersionAdded: '1.68'
32723272

32733273
Style/BlockComments:
32743274
Description: 'Do not use block comments.'
@@ -3556,7 +3556,7 @@ Style/ColonMethodDefinition:
35563556
Style/CombinableDefined:
35573557
Description: 'Checks successive `defined?` calls that can be combined into a single call.'
35583558
Enabled: pending
3559-
VersionAdded: '<<next>>'
3559+
VersionAdded: '1.68'
35603560

35613561
Style/CombinableLoops:
35623562
Description: >-
@@ -4287,7 +4287,7 @@ Style/KeywordArgumentsMerging:
42874287
directly rather than using `merge`.
42884288
StyleGuide: '#merging-keyword-arguments'
42894289
Enabled: pending
4290-
VersionAdded: '<<next>>'
4290+
VersionAdded: '1.68'
42914291

42924292
Style/KeywordParametersOrder:
42934293
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
@@ -5278,7 +5278,7 @@ Style/SafeNavigationChainLength:
52785278
Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
52795279
StyleGuide: '#safe-navigation'
52805280
Enabled: pending
5281-
VersionAdded: '<<next>>'
5281+
VersionAdded: '1.68'
52825282
Max: 2
52835283

52845284
Style/Sample:

docs/antora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: rubocop
22
title: RuboCop
33
# We always provide version without patch here (e.g. 1.1),
44
# as patch versions should not appear in the docs.
5-
version: ~
5+
version: '1.68'
66
nav:
77
- modules/ROOT/nav.adoc

docs/modules/ROOT/pages/cops.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ In the following section you find all available cops:
320320
* xref:cops_lint.adoc#linttrailingcommainattributedeclaration[Lint/TrailingCommaInAttributeDeclaration]
321321
* xref:cops_lint.adoc#linttriplequotes[Lint/TripleQuotes]
322322
* xref:cops_lint.adoc#lintunderscoreprefixedvariablename[Lint/UnderscorePrefixedVariableName]
323+
* xref:cops_lint.adoc#lintunescapedbracketinregexp[Lint/UnescapedBracketInRegexp]
323324
* xref:cops_lint.adoc#lintunexpectedblockarity[Lint/UnexpectedBlockArity]
324325
* xref:cops_lint.adoc#lintunifiedinteger[Lint/UnifiedInteger]
325326
* xref:cops_lint.adoc#lintunmodifiedreduceaccumulator[Lint/UnmodifiedReduceAccumulator]
@@ -393,6 +394,7 @@ In the following section you find all available cops:
393394
* xref:cops_style.adoc#styleaccessmodifierdeclarations[Style/AccessModifierDeclarations]
394395
* xref:cops_style.adoc#styleaccessorgrouping[Style/AccessorGrouping]
395396
* xref:cops_style.adoc#stylealias[Style/Alias]
397+
* xref:cops_style.adoc#styleambiguousendlessmethoddefinition[Style/AmbiguousEndlessMethodDefinition]
396398
* xref:cops_style.adoc#styleandor[Style/AndOr]
397399
* xref:cops_style.adoc#styleargumentsforwarding[Style/ArgumentsForwarding]
398400
* xref:cops_style.adoc#stylearraycoercion[Style/ArrayCoercion]
@@ -405,6 +407,7 @@ In the following section you find all available cops:
405407
* xref:cops_style.adoc#stylebarepercentliterals[Style/BarePercentLiterals]
406408
* xref:cops_style.adoc#stylebeginblock[Style/BeginBlock]
407409
* xref:cops_style.adoc#stylebisectedattraccessor[Style/BisectedAttrAccessor]
410+
* xref:cops_style.adoc#stylebitwisepredicate[Style/BitwisePredicate]
408411
* xref:cops_style.adoc#styleblockcomments[Style/BlockComments]
409412
* xref:cops_style.adoc#styleblockdelimiters[Style/BlockDelimiters]
410413
* xref:cops_style.adoc#stylecaseequality[Style/CaseEquality]
@@ -420,6 +423,7 @@ In the following section you find all available cops:
420423
* xref:cops_style.adoc#stylecollectionmethods[Style/CollectionMethods]
421424
* xref:cops_style.adoc#stylecolonmethodcall[Style/ColonMethodCall]
422425
* xref:cops_style.adoc#stylecolonmethoddefinition[Style/ColonMethodDefinition]
426+
* xref:cops_style.adoc#stylecombinabledefined[Style/CombinableDefined]
423427
* xref:cops_style.adoc#stylecombinableloops[Style/CombinableLoops]
424428
* xref:cops_style.adoc#stylecommandliteral[Style/CommandLiteral]
425429
* xref:cops_style.adoc#stylecommentannotation[Style/CommentAnnotation]
@@ -492,6 +496,7 @@ In the following section you find all available cops:
492496
* xref:cops_style.adoc#styleinversemethods[Style/InverseMethods]
493497
* xref:cops_style.adoc#styleinvertibleunlesscondition[Style/InvertibleUnlessCondition]
494498
* xref:cops_style.adoc#styleipaddresses[Style/IpAddresses]
499+
* xref:cops_style.adoc#stylekeywordargumentsmerging[Style/KeywordArgumentsMerging]
495500
* xref:cops_style.adoc#stylekeywordparametersorder[Style/KeywordParametersOrder]
496501
* xref:cops_style.adoc#stylelambda[Style/Lambda]
497502
* xref:cops_style.adoc#stylelambdacall[Style/LambdaCall]
@@ -599,6 +604,7 @@ In the following section you find all available cops:
599604
* xref:cops_style.adoc#stylereturnnil[Style/ReturnNil]
600605
* xref:cops_style.adoc#stylereturnnilinpredicatemethoddefinition[Style/ReturnNilInPredicateMethodDefinition]
601606
* xref:cops_style.adoc#stylesafenavigation[Style/SafeNavigation]
607+
* xref:cops_style.adoc#stylesafenavigationchainlength[Style/SafeNavigationChainLength]
602608
* xref:cops_style.adoc#stylesample[Style/Sample]
603609
* xref:cops_style.adoc#styleselectbyregexp[Style/SelectByRegexp]
604610
* xref:cops_style.adoc#styleselfassignment[Style/SelfAssignment]

docs/modules/ROOT/pages/cops_layout.adoc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4452,6 +4452,33 @@ attr_reader :name #: String
44524452
attr_reader :age #: Integer?
44534453
----
44544454
4455+
[#allowsteepannotation_-false-_default_-layoutleadingcommentspace]
4456+
==== AllowSteepAnnotation: false (default)
4457+
4458+
[source,ruby]
4459+
----
4460+
# bad
4461+
[1, 2, 3].each_with_object([]) do |n, list| #$ Array[Integer]
4462+
list << n
4463+
end
4464+
4465+
name = 'John' #: String
4466+
----
4467+
4468+
[#allowsteepannotation_-true-layoutleadingcommentspace]
4469+
==== AllowSteepAnnotation: true
4470+
4471+
[source,ruby]
4472+
----
4473+
# good
4474+
4475+
[1, 2, 3].each_with_object([]) do |n, list| #$ Array[Integer]
4476+
list << n
4477+
end
4478+
4479+
name = 'John' #: String
4480+
----
4481+
44554482
[#configurable-attributes-layoutleadingcommentspace]
44564483
=== Configurable attributes
44574484
@@ -4469,6 +4496,10 @@ attr_reader :age #: Integer?
44694496
| AllowRBSInlineAnnotation
44704497
| `false`
44714498
| Boolean
4499+
4500+
| AllowSteepAnnotation
4501+
| `false`
4502+
| Boolean
44724503
|===
44734504
44744505
[#references-layoutleadingcommentspace]

docs/modules/ROOT/pages/cops_lint.adoc

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,9 @@ the above basic literal values.
11831183
With `IgnoreConstantBranches: true`, branches are not registered
11841184
as offenses if they return a constant value.
11851185
1186+
With `IgnoreDuplicateElseBranch: true`, in conditionals with multiple branches,
1187+
duplicate 'else' branches are not registered as offenses.
1188+
11861189
[#examples-lintduplicatebranch]
11871190
=== Examples
11881191
@@ -1266,6 +1269,21 @@ else MEDIUM_SIZE
12661269
end
12671270
----
12681271
1272+
[#ignoreduplicateelsebranch_-true-lintduplicatebranch]
1273+
==== IgnoreDuplicateElseBranch: true
1274+
1275+
[source,ruby]
1276+
----
1277+
# good
1278+
if foo
1279+
do_foo
1280+
elsif bar
1281+
do_bar
1282+
else
1283+
do_foo
1284+
end
1285+
----
1286+
12691287
[#configurable-attributes-lintduplicatebranch]
12701288
=== Configurable attributes
12711289
@@ -1279,6 +1297,10 @@ end
12791297
| IgnoreConstantBranches
12801298
| `false`
12811299
| Boolean
1300+
1301+
| IgnoreDuplicateElseBranch
1302+
| `false`
1303+
| Boolean
12821304
|===
12831305
12841306
[#lintduplicatecasecondition]
@@ -6629,6 +6651,48 @@ end
66296651
| Boolean
66306652
|===
66316653
6654+
[#lintunescapedbracketinregexp]
6655+
== Lint/UnescapedBracketInRegexp
6656+
6657+
|===
6658+
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
6659+
6660+
| Pending
6661+
| Yes
6662+
| Always
6663+
| 1.68
6664+
| -
6665+
|===
6666+
6667+
Checks for Regexpes (both literals and via `Regexp.new` / `Regexp.compile`)
6668+
that contain unescaped `]` characters.
6669+
6670+
It emulates the following Ruby warning:
6671+
6672+
[source,ruby]
6673+
----
6674+
$ ruby -e '/abc]123/'
6675+
-e:1: warning: regular expression has ']' without escape: /abc]123/
6676+
----
6677+
6678+
[#examples-lintunescapedbracketinregexp]
6679+
=== Examples
6680+
6681+
[source,ruby]
6682+
----
6683+
# bad
6684+
/abc]123/
6685+
%r{abc]123}
6686+
Regexp.new('abc]123')
6687+
Regexp.compile('abc]123')
6688+
6689+
# good
6690+
/abc\]123/
6691+
%r{abc\]123}
6692+
Regexp.new('abc\]123')
6693+
Regexp.compile('abc\]123')
6694+
----
6695+
66326696
[#lintunexpectedblockarity]
66336697
== Lint/UnexpectedBlockArity
66346698

docs/modules/ROOT/pages/cops_metrics.adoc

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -394,21 +394,28 @@ operator (or keyword and) can be converted to a nested if statement,
394394
and ||/or is shorthand for a sequence of ifs, so they also add one.
395395
Loops can be said to have an exit condition, so they add one.
396396
Blocks that are calls to builtin iteration methods
397-
(e.g. `ary.map{...}) also add one, others are ignored.
397+
(e.g. `ary.map{...}`) also add one, others are ignored.
398398
399-
def each_child_node(*types) # count begins: 1
400-
unless block_given? # unless: +1
401-
return to_enum(__method__, *types)
399+
[#examples-metricscyclomaticcomplexity]
400+
=== Examples
401+
402+
[source,ruby]
403+
----
404+
def each_child_node(*types) # count begins: 1
405+
unless block_given? # unless: +1
406+
return to_enum(__method__, *types)
407+
end
402408
403-
children.each do |child| # each{}: +1
404-
next unless child.is_a?(Node) # unless: +1
409+
children.each do |child| # each{}: +1
410+
next unless child.is_a?(Node) # unless: +1
405411
406-
yield child if types.empty? || # if: +1, ||: +1
407-
types.include?(child.type)
408-
end
412+
yield child if types.empty? || # if: +1, ||: +1
413+
types.include?(child.type)
414+
end
409415
410-
self
411-
end # total: 6
416+
self
417+
end # total: 6
418+
----
412419
413420
[#configurable-attributes-metricscyclomaticcomplexity]
414421
=== Configurable attributes

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy