Skip to content

Commit

Permalink
Cut 1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Feb 15, 2021
1 parent 53d8723 commit 9e8a5ee
Show file tree
Hide file tree
Showing 14 changed files with 242 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Expand Up @@ -38,7 +38,7 @@ output by `rubocop -V`, include them as well. Here's an example:

```
$ [bundle exec] rubocop -V
1.9.1 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
1.10.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
Expand Up @@ -2,6 +2,8 @@

## master (unreleased)

## 1.10.0 (2021-02-15)

### New features

* [#9478](https://github.com/rubocop-hq/rubocop/pull/9478): Add new `Style/HashConversion` cop. ([@zverok][])
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -17,7 +17,7 @@ do so.

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

See [versioning](https://docs.rubocop.org/rubocop/1.0/versioning.html) for further details.
Expand Down
8 changes: 4 additions & 4 deletions config/default.yml
Expand Up @@ -206,7 +206,7 @@ Bundler/OrderedGems:
Gemspec/DateAssignment:
Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
Enabled: pending
VersionAdded: '<<next>>'
VersionAdded: '1.10'
Include:
- '**/*.gemspec'

Expand Down Expand Up @@ -1453,7 +1453,7 @@ Lint/Debugger:
Description: 'Check for debugger calls.'
Enabled: true
VersionAdded: '0.14'
VersionChanged: <<next>>
VersionChanged: '1.10'
DebuggerReceivers: [] # deprecated
DebuggerMethods:
# Groups are available so that a specific group can be disabled in
Expand Down Expand Up @@ -3102,7 +3102,7 @@ Style/ConstantVisibility:
visibility declarations.
Enabled: false
VersionAdded: '0.66'
VersionChanged: <<next>>
VersionChanged: '1.10'
IgnoreModules: false

# Checks that you have put a copyright in a comment before any code.
Expand Down Expand Up @@ -3445,7 +3445,7 @@ Style/HashAsLastArrayItem:
Style/HashConversion:
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
Enabled: pending
VersionAdded: <<next>>
VersionAdded: '1.10'

Style/HashEachMethods:
Description: 'Use Hash#each_key and Hash#each_value.'
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
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.10'
nav:
- modules/ROOT/nav.adoc
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/cops.adoc
Expand Up @@ -80,6 +80,7 @@ In the following section you find all available cops:

=== Department xref:cops_gemspec.adoc[Gemspec]

* xref:cops_gemspec.adoc#gemspecdateassignment[Gemspec/DateAssignment]
* xref:cops_gemspec.adoc#gemspecduplicatedassignment[Gemspec/DuplicatedAssignment]
* xref:cops_gemspec.adoc#gemspecordereddependencies[Gemspec/OrderedDependencies]
* xref:cops_gemspec.adoc#gemspecrequiredrubyversion[Gemspec/RequiredRubyVersion]
Expand Down Expand Up @@ -418,6 +419,7 @@ In the following section you find all available cops:
* xref:cops_style.adoc#styleglobalvars[Style/GlobalVars]
* xref:cops_style.adoc#styleguardclause[Style/GuardClause]
* xref:cops_style.adoc#stylehashaslastarrayitem[Style/HashAsLastArrayItem]
* xref:cops_style.adoc#stylehashconversion[Style/HashConversion]
* xref:cops_style.adoc#stylehasheachmethods[Style/HashEachMethods]
* xref:cops_style.adoc#stylehashexcept[Style/HashExcept]
* xref:cops_style.adoc#stylehashlikecase[Style/HashLikeCase]
Expand Down
41 changes: 41 additions & 0 deletions docs/modules/ROOT/pages/cops_gemspec.adoc
@@ -1,5 +1,46 @@
= Gemspec

== Gemspec/DateAssignment

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

| Pending
| Yes
| Yes
| 1.10
| -
|===

This cop checks that `date =` is not used in gemspec file.
It is set automatically when the gem is packaged.

=== Examples

[source,ruby]
----
# bad
Gem::Specification.new do |spec|
s.name = 'your_cool_gem_name'
spec.date = Time.now.strftime('%Y-%m-%d')
end
# good
Gem::Specification.new do |spec|
s.name = 'your_cool_gem_name'
end
----

=== Configurable attributes

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

| Include
| `+**/*.gemspec+`
| Array
|===

== Gemspec/DuplicatedAssignment

|===
Expand Down
33 changes: 33 additions & 0 deletions docs/modules/ROOT/pages/cops_layout.adoc
Expand Up @@ -4181,6 +4181,39 @@ foo = if expression
end
----

==== SupportedTypes: ['block', 'case', 'class', 'if', 'kwbegin', 'module'] (default)

[source,ruby]
----
# good
foo =
if expression
'bar'
end
# good
foo =
[1].map do |i|
i + 1
end
----

==== SupportedTypes: ['block']

[source,ruby]
----
# good
foo = if expression
'bar'
end
# good
foo =
[1].map do |i|
'bar' * i
end
----

=== Configurable attributes

|===
Expand Down
40 changes: 29 additions & 11 deletions docs/modules/ROOT/pages/cops_lint.adoc
Expand Up @@ -579,11 +579,23 @@ Login
| Yes
| No
| 0.14
| 0.49
| 1.10
|===

This cop checks for calls to debugger or pry.
The cop can be configured to define which methods and receivers must be fixed.
This cop checks for debug calls (such as `debugger` or `binding.pry`) that should
not be kept for production code.

The cop can be configured using `DebuggerMethods`. By default, a number of gems
debug entrypoints are configured (`Kernel`, `Byebug`, `Capybara`, `Pry`, `Rails`,
and `WebConsole`). Additional methods can be added.

Specific default groups can be disabled if necessary:

[source,yaml]
----
Lint/Debugger:
WebConsole: ~
---
=== Examples
Expand Down Expand Up @@ -618,18 +630,29 @@ def some_method
end
----
==== DebuggerMethods: [my_debugger]
[source,ruby]
----
# bad (ok during development)

def some_method
my_debugger
end
----
=== Configurable attributes
|===
| Name | Default value | Configurable values
| DebuggerReceivers
| `binding`, `Kernel`, `Pry`
| `[]`
| Array
| DebuggerMethods
| `debugger`, `byebug`, `remote_byebug`, `pry`, `remote_pry`, `pry_remote`, `console`, `rescue`, `save_and_open_page`, `save_and_open_screenshot`, `irb`
| Array
| `{"Kernel"=>["binding.irb"], "Byebug"=>["byebug", "remote_byebug", "Kernel.byebug", "Kernel.remote_byebug"], "Capybara"=>["save_and_open_page", "save_and_open_screenshot"], "Pry"=>["binding.pry", "binding.remote_pry", "binding.pry_remote", "Pry.rescue"], "Rails"=>["debugger", "Kernel.debugger"], "WebConsole"=>["binding.console"]}`
|
|===
== Lint/DeprecatedClassMethods
Expand Down Expand Up @@ -2760,15 +2783,10 @@ comparison operators.
[source,ruby]
----
# bad
x < y < z
10 <= x <= 20
----

[source,ruby]
----
# good
x < y && y < z
10 <= x && x <= 20
----
Expand Down

0 comments on commit 9e8a5ee

Please sign in to comment.