Skip to content

Commit 4c16de9

Browse files
committed
Cut 1.35
1 parent 4f3d100 commit 4c16de9

File tree

13 files changed

+220
-17
lines changed

13 files changed

+220
-17
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.34.1 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
41+
1.35.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
4242
- rubocop-performance 1.9.1
4343
- rubocop-rspec 2.0.0
4444
```

CHANGELOG.md

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

33
## master (unreleased)
44

5+
## 1.35.0 (2022-08-12)
6+
57
### New features
68

79
* [#9364](https://github.com/rubocop/rubocop/pull/9364): Add `Style/MagicCommentFormat` cop. ([@dvandersluis][], [@mattbearman][])

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.34.1 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
20+
1.35.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
2121
- rubocop-performance 1.9.1
2222
- rubocop-rspec 2.0.0
2323
```

README.md

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

5555
```rb
56-
gem 'rubocop', '~> 1.34', require: false
56+
gem 'rubocop', '~> 1.35', require: false
5757
```
5858

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

config/default.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4020,7 +4020,7 @@ Style/LineEndConcatenation:
40204020
Style/MagicCommentFormat:
40214021
Description: 'Use a consistent style for magic comments.'
40224022
Enabled: pending
4023-
VersionAdded: '<<next>>'
4023+
VersionAdded: '1.35'
40244024
EnforcedStyle: snake_case
40254025
SupportedStyles:
40264026
# `snake` will enforce the magic comment is written

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.35'
66
nav:
77
- modules/ROOT/nav.adoc

docs/modules/ROOT/pages/cops.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ In the following section you find all available cops:
471471
* xref:cops_style.adoc#stylelambda[Style/Lambda]
472472
* xref:cops_style.adoc#stylelambdacall[Style/LambdaCall]
473473
* xref:cops_style.adoc#stylelineendconcatenation[Style/LineEndConcatenation]
474+
* xref:cops_style.adoc#stylemagiccommentformat[Style/MagicCommentFormat]
474475
* xref:cops_style.adoc#stylemapcompactwithconditionalblock[Style/MapCompactWithConditionalBlock]
475476
* xref:cops_style.adoc#stylemaptohash[Style/MapToHash]
476477
* xref:cops_style.adoc#stylemethodcallwithargsparentheses[Style/MethodCallWithArgsParentheses]

docs/modules/ROOT/pages/cops_layout.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4278,6 +4278,7 @@ are recommended to further format the broken lines.
42784278
(Many of these are enabled by default.)
42794279

42804280
* ArgumentAlignment
4281+
* ArrayAlignment
42814282
* BlockAlignment
42824283
* BlockDelimiters
42834284
* BlockEndNewline

docs/modules/ROOT/pages/cops_lint.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,18 +2284,18 @@ NOTE: Required Ruby version: 2.6
22842284

22852285
This cop emulates the following Ruby warnings in Ruby 2.6.
22862286

2287+
[source,console]
2288+
----
22872289
% cat example.rb
22882290
ERB.new('hi', nil, '-', '@output_buffer')
22892291
% ruby -rerb example.rb
2290-
example.rb:1: warning: Passing safe_level with the 2nd argument of
2291-
ERB.new is deprecated. Do not use it, and specify other arguments as
2292-
keyword arguments.
2293-
example.rb:1: warning: Passing trim_mode with the 3rd argument of
2294-
ERB.new is deprecated. Use keyword argument like
2295-
ERB.new(str, trim_mode:...) instead.
2296-
example.rb:1: warning: Passing eoutvar with the 4th argument of ERB.new
2297-
is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...)
2298-
instead.
2292+
example.rb:1: warning: Passing safe_level with the 2nd argument of ERB.new is
2293+
deprecated. Do not use it, and specify other arguments as keyword arguments.
2294+
example.rb:1: warning: Passing trim_mode with the 3rd argument of ERB.new is
2295+
deprecated. Use keyword argument like ERB.new(str, trim_mode:...) instead.
2296+
example.rb:1: warning: Passing eoutvar with the 4th argument of ERB.new is
2297+
deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.
2298+
----
22992299

23002300
Now non-keyword arguments other than first one are softly deprecated
23012301
and will be removed when Ruby 2.5 becomes EOL.

docs/modules/ROOT/pages/cops_style.adoc

Lines changed: 174 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5180,6 +5180,7 @@ The supported styles are:
51805180
* always - forces use of the 3.1 syntax (e.g. {foo:})
51815181
* never - forces use of explicit hash literal value
51825182
* either - accepts both shorthand and explicit use of hash literal value
5183+
* consistent - like "always", but will avoid mixing styles in a single hash
51835184

51845185
=== Examples
51855186

@@ -5268,6 +5269,23 @@ The supported styles are:
52685269
{foo:, bar:}
52695270
----
52705271

5272+
==== EnforcedShorthandSyntax: consistent
5273+
5274+
[source,ruby]
5275+
----
5276+
# bad
5277+
{foo: , bar: bar}
5278+
5279+
# good
5280+
{foo:, bar:}
5281+
5282+
# bad
5283+
{foo: , bar: baz}
5284+
5285+
# good
5286+
{foo: foo, bar: baz}
5287+
----
5288+
52715289
=== Configurable attributes
52725290

52735291
|===
@@ -5279,7 +5297,7 @@ The supported styles are:
52795297

52805298
| EnforcedShorthandSyntax
52815299
| `always`
5282-
| `always`, `never`, `either`
5300+
| `always`, `never`, `either`, `consistent`
52835301

52845302
| UseHashRocketsWithSymbolValues
52855303
| `false`
@@ -6250,6 +6268,161 @@ some_str = 'ala' \
62506268
'bala'
62516269
----
62526270

6271+
== Style/MagicCommentFormat
6272+
6273+
|===
6274+
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
6275+
6276+
| Pending
6277+
| Yes
6278+
| Yes
6279+
| 1.35
6280+
| -
6281+
|===
6282+
6283+
Ensures magic comments are written consistently throughout your code base.
6284+
Looks for discrepancies in separators (`-` vs `_`) and capitalization for
6285+
both magic comment directives and values.
6286+
6287+
Required capitalization can be set with the `DirectiveCapitalization` and
6288+
`ValueCapitalization` configuration keys.
6289+
6290+
NOTE: If one of these configuration is set to nil, any capitalization is allowed.
6291+
6292+
=== Examples
6293+
6294+
==== EnforcedStyle: snake_case (default)
6295+
6296+
[source,ruby]
6297+
----
6298+
# The `snake_case` style will enforce that the frozen string literal
6299+
# comment is written in snake case. (Words separated by underscores)
6300+
# bad
6301+
# frozen-string-literal: true
6302+
6303+
module Bar
6304+
# ...
6305+
end
6306+
6307+
# good
6308+
# frozen_string_literal: false
6309+
6310+
module Bar
6311+
# ...
6312+
end
6313+
----
6314+
6315+
==== EnforcedStyle: kebab_case
6316+
6317+
[source,ruby]
6318+
----
6319+
# The `kebab_case` style will enforce that the frozen string literal
6320+
# comment is written in kebab case. (Words separated by hyphens)
6321+
# bad
6322+
# frozen_string_literal: true
6323+
6324+
module Baz
6325+
# ...
6326+
end
6327+
6328+
# good
6329+
# frozen-string-literal: true
6330+
6331+
module Baz
6332+
# ...
6333+
end
6334+
----
6335+
6336+
==== DirectiveCapitalization: lowercase (default)
6337+
6338+
[source,ruby]
6339+
----
6340+
# bad
6341+
# FROZEN-STRING-LITERAL: true
6342+
6343+
# good
6344+
# frozen-string-literal: true
6345+
----
6346+
6347+
==== DirectiveCapitalization: uppercase
6348+
6349+
[source,ruby]
6350+
----
6351+
# bad
6352+
# frozen-string-literal: true
6353+
6354+
# good
6355+
# FROZEN-STRING-LITERAL: true
6356+
----
6357+
6358+
==== DirectiveCapitalization: nil
6359+
6360+
[source,ruby]
6361+
----
6362+
# any capitalization is accepted
6363+
6364+
# good
6365+
# frozen-string-literal: true
6366+
6367+
# good
6368+
# FROZEN-STRING-LITERAL: true
6369+
----
6370+
6371+
==== ValueCapitalization: nil (default)
6372+
6373+
[source,ruby]
6374+
----
6375+
# any capitalization is accepted
6376+
6377+
# good
6378+
# frozen-string-literal: true
6379+
6380+
# good
6381+
# frozen-string-literal: TRUE
6382+
----
6383+
6384+
==== ValueCapitalization: lowercase
6385+
6386+
[source,ruby]
6387+
----
6388+
# when a value is not given, any capitalization is accepted
6389+
6390+
# bad
6391+
# frozen-string-literal: TRUE
6392+
6393+
# good
6394+
# frozen-string-literal: TRUE
6395+
----
6396+
6397+
==== ValueCapitalization: uppercase
6398+
6399+
[source,ruby]
6400+
----
6401+
# bad
6402+
# frozen-string-literal: true
6403+
6404+
# good
6405+
# frozen-string-literal: TRUE
6406+
----
6407+
6408+
=== Configurable attributes
6409+
6410+
|===
6411+
| Name | Default value | Configurable values
6412+
6413+
| EnforcedStyle
6414+
| `snake_case`
6415+
| `snake_case`, `kebab_case`
6416+
6417+
| DirectiveCapitalization
6418+
| `lowercase`
6419+
| String
6420+
6421+
| ValueCapitalization
6422+
| `<none>`
6423+
|
6424+
|===
6425+
62536426
== Style/MapCompactWithConditionalBlock
62546427

62556428
|===

0 commit comments

Comments
 (0)