Skip to content

Commit

Permalink
Cut 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Mar 24, 2021
1 parent 50650dd commit fa02e85
Show file tree
Hide file tree
Showing 13 changed files with 276 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.11.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
1.12.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.12.0 (2021-03-24)

### New features

* [#9615](https://github.com/rubocop/rubocop/pull/9615): Add new `Style/StringChars` 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.

```
$ rubocop -V
1.11.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
1.12.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 @@ -51,7 +51,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
in your `Gemfile`:

```rb
gem 'rubocop', '~> 1.11', require: false
gem 'rubocop', '~> 1.12', 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 @@ -2057,7 +2057,7 @@ Lint/SuppressedException:
AllowComments: true
AllowNil: true
VersionAdded: '0.9'
VersionChanged: <<next>>
VersionChanged: '1.12'

Lint/SymbolConversion:
Description: 'Checks for unnecessary symbol conversions.'
Expand Down Expand Up @@ -4504,7 +4504,7 @@ Style/StringChars:
StyleGuide: '#string-chars'
Enabled: pending
Safe: false
VersionAdded: '<<next>>'
VersionAdded: '1.12'

Style/StringConcatenation:
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
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.12'
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 @@ -528,6 +528,7 @@ In the following section you find all available cops:
* xref:cops_style.adoc#stylestabbylambdaparentheses[Style/StabbyLambdaParentheses]
* xref:cops_style.adoc#stylestaticclass[Style/StaticClass]
* xref:cops_style.adoc#stylestderrputs[Style/StderrPuts]
* xref:cops_style.adoc#stylestringchars[Style/StringChars]
* xref:cops_style.adoc#stylestringconcatenation[Style/StringConcatenation]
* xref:cops_style.adoc#stylestringhashkeys[Style/StringHashKeys]
* xref:cops_style.adoc#stylestringliterals[Style/StringLiterals]
Expand Down
108 changes: 107 additions & 1 deletion docs/modules/ROOT/pages/cops_lint.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4645,7 +4645,7 @@ g.count #=> 2
| Yes
| No
| 0.9
| 0.81
| 1.12
|===

This cop checks for `rescue` blocks with no body.
Expand Down Expand Up @@ -4719,6 +4719,50 @@ rescue
end
----

==== AllowNil: true (default)

[source,ruby]
----
# good
def some_method
do_something
rescue
nil
end
# good
begin
do_something
rescue
# do nothing
end
# good
do_something rescue nil
----

==== AllowNil: false

[source,ruby]
----
# bad
def some_method
do_something
rescue
nil
end
# bad
begin
do_something
rescue
nil
end
# bad
do_something rescue nil
----

=== Configurable attributes

|===
Expand All @@ -4727,6 +4771,10 @@ end
| AllowComments
| `true`
| Boolean

| AllowNil
| `true`
| Boolean
|===

=== References
Expand All @@ -4748,6 +4796,12 @@ end
This cop checks for uses of literal strings converted to
a symbol where a literal symbol could be used instead.

There are two possible styles for this cop.
`strict` (default) will register an offense for any incorrect usage.
`consistent` additionally requires hashes to use the same style for
every symbol key (ie. if any symbol key needs to be quoted it requires
all keys to be quoted).

=== Examples

[source,ruby]
Expand All @@ -4767,6 +4821,58 @@ a symbol where a literal symbol could be used instead.
:'hyphenated-string'
----

==== EnforcedStyle: strict (default)

[source,ruby]
----
# bad
{
'a': 1,
"b": 2,
'c-d': 3
}
# good (don't quote keys that don't require quoting)
{
a: 1,
b: 2,
'c-d': 3
}
----

==== EnforcedStyle: consistent

[source,ruby]
----
# bad
{
a: 1,
'b-c': 2
}
# good (quote all keys if any need quoting)
{
'a': 1,
'b-c': 2
}
# good (no quoting required)
{
a: 1,
b: 2
}
----

=== Configurable attributes

|===
| Name | Default value | Configurable values

| EnforcedStyle
| `strict`
| `strict`, `consistent`
|===

== Lint/Syntax

|===
Expand Down
11 changes: 10 additions & 1 deletion docs/modules/ROOT/pages/cops_naming.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ EOS
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged

| Enabled
| Yes
| No
| No
| 0.53
| 1.2
Expand All @@ -532,6 +532,10 @@ prefixed with an underscore. Prefixing ivars with an underscore is a
convention that is used to implicitly indicate that an ivar should not
be set or referenced outside of the memoization method.

This cop relies on the pattern `@instance_var ||= ...`,
but this is sometimes used for other purposes than memoization
so this cop is considered unsafe.

=== Examples

==== EnforcedStyleForLeadingUnderscores: disallowed (default)
Expand Down Expand Up @@ -916,6 +920,11 @@ expected.
The `PreferredName` config option takes a `String`. It represents
the required name of the variable. Its default is `e`.

NOTE: This cop does not consider nested rescues because it cannot
guarantee that the variable from the outer rescue is not used within
the inner rescue (in which case, changing the inner variable would
shadow the outer variable).

=== Examples

==== PreferredName: e (default)
Expand Down

0 comments on commit fa02e85

Please sign in to comment.