From a9cef6dde89c9e16144f1242a66c3115046a1fe3 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Thu, 4 Aug 2022 12:25:10 +0300 Subject: [PATCH] Cut 1.33 --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- CHANGELOG.md | 2 + CONTRIBUTING.md | 2 +- README.md | 2 +- config/default.yml | 2 +- docs/antora.yml | 2 +- docs/modules/ROOT/pages/cops_lint.adoc | 88 +++++++-- docs/modules/ROOT/pages/cops_metrics.adoc | 58 +++++- docs/modules/ROOT/pages/cops_naming.adoc | 27 ++- docs/modules/ROOT/pages/cops_style.adoc | 225 ++++++++++++++++++---- docs/modules/ROOT/pages/installation.adoc | 2 +- lib/rubocop/version.rb | 2 +- relnotes/v1.33.0.md | 25 +++ 13 files changed, 376 insertions(+), 63 deletions(-) create mode 100644 relnotes/v1.33.0.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c813e8dbb083..5478fdeae9e2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -38,7 +38,7 @@ output by `rubocop -V`, include them as well. Here's an example: ``` $ [bundle exec] rubocop -V -1.32.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux) +1.33.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 ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index fa4b34172e2e..eea494804164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master (unreleased) +## 1.33.0 (2022-08-04) + ### Bug fixes * [#10830](https://github.com/rubocop/rubocop/issues/10830): Fix an incorrect autocorrect for `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: consistent` of `Layout/FirstArgumentIndentation` and enabling `Layout/FirstMethodArgumentLineBreak`. ([@koic][]) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5e3a0db113b..f62e8571baaa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ do so. ```console $ rubocop -V -1.32.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux) +1.33.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 ``` diff --git a/README.md b/README.md index b5e4be2ef52a..5a17ff3a8896 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi in your `Gemfile`: ```rb -gem 'rubocop', '~> 1.32', require: false +gem 'rubocop', '~> 1.33', require: false ``` See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details. diff --git a/config/default.yml b/config/default.yml index e8e2398c0791..2f9b1f89f969 100644 --- a/config/default.yml +++ b/config/default.yml @@ -1755,7 +1755,7 @@ Lint/EmptyConditionalBody: Enabled: true AllowComments: true VersionAdded: '0.89' - VersionChanged: '<>' + VersionChanged: '1.33' Lint/EmptyEnsure: Description: 'Checks for empty ensure block.' diff --git a/docs/antora.yml b/docs/antora.yml index 9c897ea03d1d..90ca0721d180 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -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: ~ +version: '1.33' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_lint.adoc b/docs/modules/ROOT/pages/cops_lint.adoc index d49b7c66eca1..d63d94fa3b70 100644 --- a/docs/modules/ROOT/pages/cops_lint.adoc +++ b/docs/modules/ROOT/pages/cops_lint.adoc @@ -46,8 +46,8 @@ x != y # or x = !y Checks for ambiguous block association with method when param passed without parentheses. -This cop can customize ignored methods with `IgnoredMethods`. -By default, there are no methods to ignored. +This cop can customize allowed methods with `AllowedMethods`. +By default, there are no methods to allowed. === Examples @@ -74,7 +74,7 @@ foo == bar { |b| b.baz } foo = ->(bar) { bar.baz } ---- -==== IgnoredMethods: [] (default) +==== AllowedMethods: [] (default) [source,ruby] ---- @@ -82,7 +82,7 @@ foo = ->(bar) { bar.baz } expect { do_something }.to change { object.attribute } ---- -==== IgnoredMethods: [change] +==== AllowedMethods: [change] [source,ruby] ---- @@ -90,11 +90,36 @@ expect { do_something }.to change { object.attribute } expect { do_something }.to change { object.attribute } ---- +==== AllowedPatterns: [] (default) + +[source,ruby] +---- +# bad +expect { do_something }.to change { object.attribute } +---- + +==== AllowedPatterns: [/change/] + +[source,ruby] +---- +# good +expect { do_something }.to change { object.attribute } +expect { do_something }.to not_change { object.attribute } +---- + === Configurable attributes |=== | Name | Default value | Configurable values +| AllowedMethods +| `[]` +| Array + +| AllowedPatterns +| `[]` +| Array + | IgnoredMethods | `[]` | Array @@ -808,7 +833,18 @@ Specific default groups can be disabled if necessary: [source,yaml] ---- Lint/Debugger: - WebConsole: ~ + DebuggerMethods: + WebConsole: ~ +---- + +You can also add your own methods by adding a new category: + +[source,yaml] +---- +Lint/Debugger: + DebuggerMethods: + MyDebugger: + MyDebugger.debug_this ---- === Examples @@ -1765,13 +1801,15 @@ end | Enabled | Yes -| No +| Yes | 0.89 -| - +| 1.33 |=== Checks for the presence of `if`, `elsif` and `unless` branches without a body. +NOTE: empty `else` branches are handled by `Style/EmptyElse`. + === Examples [source,ruby] @@ -3449,6 +3487,10 @@ end FileUtils.rm_f(path) ---- +=== References + +* https://rubystyle.guide#atomic-file-operations + == Lint/NonDeterministicRequireOrder |=== @@ -3594,8 +3636,8 @@ always correct to raise if a value is not numeric. NOTE: Some values cannot be converted properly using one of the `Kernel` method (for instance, `Time` and `DateTime` values are allowed by this cop by default). Similarly, Rails' duration methods do not work well -with `Integer()` and can be ignored with `IgnoredMethods`. By default, -there are no methods to ignored. +with `Integer()` and can be allowed with `AllowedMethods`. By default, +there are no methods to allowed. === Safety @@ -3628,7 +3670,23 @@ foo.try { |i| Float(i) } bar.send { |i| Complex(i) } ---- -==== IgnoredMethods: [] (default) +==== AllowedMethods: [] (default) + +[source,ruby] +---- +# bad +10.minutes.to_i +---- + +==== AllowedMethods: [minutes] + +[source,ruby] +---- +# good +10.minutes.to_i +---- + +==== AllowedPatterns: [] (default) [source,ruby] ---- @@ -3636,7 +3694,7 @@ bar.send { |i| Complex(i) } 10.minutes.to_i ---- -==== IgnoredMethods: [minutes] +==== AllowedPatterns: [/min*/] [source,ruby] ---- @@ -3657,6 +3715,14 @@ Time.now.to_datetime.to_i |=== | Name | Default value | Configurable values +| AllowedMethods +| `[]` +| Array + +| AllowedPatterns +| `[]` +| Array + | IgnoredMethods | `[]` | Array diff --git a/docs/modules/ROOT/pages/cops_metrics.adoc b/docs/modules/ROOT/pages/cops_metrics.adoc index d324e778c9b8..a3b3aee1184b 100644 --- a/docs/modules/ROOT/pages/cops_metrics.adoc +++ b/docs/modules/ROOT/pages/cops_metrics.adoc @@ -27,7 +27,8 @@ You can have repeated "attributes" calls count as a single "branch". For this purpose, attributes are any method with no argument; no attempt is meant to distinguish actual `attr_reader` from other methods. -This cop also takes into account `IgnoredMethods` (defaults to `[]`) +This cop also takes into account `AllowedMethods` (defaults to `[]`) +And `AllowedPatterns` (defaults to `[]`) === Examples @@ -54,6 +55,14 @@ end |=== | Name | Default value | Configurable values +| AllowedMethods +| `[]` +| Array + +| AllowedPatterns +| `[]` +| Array + | IgnoredMethods | `[]` | Array @@ -95,8 +104,8 @@ will be counted as one line regardless of its actual size. NOTE: The `ExcludedMethods` configuration is deprecated and only kept -for backwards compatibility. Please use `IgnoredMethods` instead. -By default, there are no methods to ignored. +for backwards compatibility. Please use `AllowedMethods` and `AllowedPatterns` +instead. By default, there are no methods to allowed. NOTE: This cop does not apply for `Struct` definitions. @@ -144,10 +153,18 @@ end # 5 points | `[]` | Array -| IgnoredMethods +| AllowedMethods | `refine` | Array +| AllowedPatterns +| `[]` +| Array + +| IgnoredMethods +| `[]` +| Array + | Exclude | `+**/*.gemspec+` | Array @@ -299,6 +316,14 @@ Blocks that are calls to builtin iteration methods |=== | Name | Default value | Configurable values +| AllowedMethods +| `[]` +| Array + +| AllowedPatterns +| `[]` +| Array + | IgnoredMethods | `[]` | Array @@ -321,16 +346,17 @@ Blocks that are calls to builtin iteration methods |=== Checks if the length of a method exceeds some maximum value. -Comment lines can optionally be ignored. +Comment lines can optionally be allowed. The maximum allowed length is configurable. You can set literals you want to fold with `CountAsOne`. Available are: 'array', 'hash', and 'heredoc'. Each literal will be counted as one line regardless of its actual size. -NOTE: The `ExcludedMethods` configuration is deprecated and only kept -for backwards compatibility. Please use `IgnoredMethods` instead. -By default, there are no methods to ignored. +NOTE: The `ExcludedMethods` and `IgnoredMethods` configuration is +deprecated and only kept for backwards compatibility. +Please use `AllowedMethods` and `AllowedPatterns` instead. +By default, there are no methods to allowed. === Examples @@ -376,6 +402,14 @@ end # 5 points | `[]` | Array +| AllowedMethods +| `[]` +| Array + +| AllowedPatterns +| `[]` +| Array + | IgnoredMethods | `[]` | Array @@ -600,6 +634,14 @@ end # 7 complexity points |=== | Name | Default value | Configurable values +| AllowedMethods +| `[]` +| Array + +| AllowedPatterns +| `[]` +| Array + | IgnoredMethods | `[]` | Array diff --git a/docs/modules/ROOT/pages/cops_naming.adoc b/docs/modules/ROOT/pages/cops_naming.adoc index 8b00a4c50f50..b3a1355e62e8 100644 --- a/docs/modules/ROOT/pages/cops_naming.adoc +++ b/docs/modules/ROOT/pages/cops_naming.adoc @@ -1075,9 +1075,30 @@ end | 0.77 |=== -Makes sure that predicates are named properly. -`is_a?` method is allowed by default. -These are customizable with `AllowedMethods` option. +Checks that predicate methods names end with a question mark and +do not start with a forbidden prefix. + +A method is determined to be a predicate method if its name starts +with one of the prefixes defined in the `NamePrefix` configuration. +You can change what prefixes are considered by changing this option. +Any method name that starts with one of these prefixes is required by +the cop to end with a `?`. Other methods can be allowed by adding to +the `AllowedMethods` configuration. + +NOTE: The `is_a?` method is allowed by default. + +If `ForbiddenPrefixes` is set, methods that start with the configured +prefixes will not be allowed and will be removed by autocorrection. + +In other words, if `ForbiddenPrefixes` is empty, a method named `is_foo` +will register an offense only due to the lack of question mark (and will be +autocorrected to `is_foo?`). If `ForbiddenPrefixes` contains `is_`, +`is_foo` will register an offense both because the ? is missing and because of +the `is_` prefix, and will be corrected to `foo?`. + +NOTE: `ForbiddenPrefixes` is only applied to prefixes in `NamePrefix`; +a prefix in the former but not the latter will not be considered by +this cop. === Examples diff --git a/docs/modules/ROOT/pages/cops_style.adoc b/docs/modules/ROOT/pages/cops_style.adoc index 32aae0b383f8..ed016b8c3cea 100644 --- a/docs/modules/ROOT/pages/cops_style.adoc +++ b/docs/modules/ROOT/pages/cops_style.adoc @@ -736,7 +736,7 @@ multi-line blocks. Methods that can be either procedural or functional and cannot be categorised from their usage alone is ignored. `lambda`, `proc`, and `it` are their defaults. -Additional methods can be added to the `IgnoredMethods`. +Additional methods can be added to the `AllowedMethods`. === Examples @@ -801,7 +801,7 @@ map { |x| x }.inspect -# The AllowBracesOnProceduralOneLiners option is ignored unless the +# The AllowBracesOnProceduralOneLiners option is allowed unless the # EnforcedStyle is set to `semantic`. If so: # If the AllowBracesOnProceduralOneLiners option is unspecified, or @@ -862,7 +862,7 @@ words.each { |word| ---- # Methods listed in the BracesRequiredMethods list, such as 'sig' # in this example, will require `{...}` braces. This option takes -# precedence over all other configurations except IgnoredMethods. +# precedence over all other configurations except AllowedMethods. # bad sig do @@ -885,7 +885,7 @@ def bar(foo) end ---- -==== IgnoredMethods: ['lambda', 'proc', 'it' ] (default) +==== AllowedMethods: ['lambda', 'proc', 'it' ] (default) [source,ruby] ---- @@ -899,6 +899,28 @@ foo = lambda do |x| end ---- +==== AllowedPatterns: [] (default) + +[source,ruby] +---- +# bad +things.map { |thing| + something = thing.some_method + process(something) +} +---- + +==== AllowedPatterns: [/map/] + +[source,ruby] +---- +# good +things.map { |thing| + something = thing.some_method + process(something) +} +---- + === Configurable attributes |=== @@ -916,10 +938,18 @@ end | `let`, `let!`, `subject`, `watch` | Array -| IgnoredMethods +| AllowedMethods | `lambda`, `proc`, `it` | Array +| AllowedPatterns +| `[]` +| Array + +| IgnoredMethods +| `[]` +| Array + | AllowBracesOnProceduralOneLiners | `false` | Boolean @@ -1217,8 +1247,8 @@ var.kind_of?(String) Enforces the use of `Object#instance_of?` instead of class comparison for equality. -`==`, `equal?`, and `eql?` methods are ignored by default. -These are customizable with `IgnoredMethods` option. +`==`, `equal?`, and `eql?` methods are allowed by default. +These are customizable with `AllowedMethods` option. === Examples @@ -1234,7 +1264,7 @@ var.class.name == 'Date' var.instance_of?(Date) ---- -==== IgnoreMethods: [] (default) +==== AllowedMethods: [] (default) [source,ruby] ---- @@ -1248,7 +1278,7 @@ var.class.eql?(Date) var.class.name == 'Date' ---- -==== IgnoreMethods: [`==`] +==== AllowedMethods: [`==`] [source,ruby] ---- @@ -1262,14 +1292,50 @@ var.class.equal?(Date) var.class.eql?(Date) ---- +==== AllowedPatterns: [] (default) + +[source,ruby] +---- +# good +var.instance_of?(Date) + +# bad +var.class == Date +var.class.equal?(Date) +var.class.eql?(Date) +var.class.name == 'Date' +---- + +==== AllowedPatterns: [`/eq/`] + +[source,ruby] +---- +# good +var.instance_of?(Date) +var.class.equal?(Date) +var.class.eql?(Date) + +# bad +var.class == Date +var.class.name == 'Date' +---- + === Configurable attributes |=== | Name | Default value | Configurable values -| IgnoredMethods +| AllowedMethods | `==`, `equal?`, `eql?` | Array + +| AllowedPatterns +| `[]` +| Array + +| IgnoredMethods +| `[]` +| Array |=== === References @@ -4325,8 +4391,8 @@ which are passed as arguments to those methods: The reason is that _unannotated_ format is very similar to encoded URLs or Date/Time formatting strings. -This cop can be customized ignored methods with `IgnoredMethods`. -By default, there are no methods to ignored. +This cop can be customized allowed methods with `AllowedMethods`. +By default, there are no methods to allowed. It is allowed to contain unannotated token if the number of them is less than or equals to @@ -4393,7 +4459,23 @@ format('%s %s.', 'Hello', 'world') format('%06d', 10) ---- -==== IgnoredMethods: [] (default) +==== AllowedMethods: [] (default) + +[source,ruby] +---- +# bad +redirect('foo/%{bar_id}') +---- + +==== AllowedMethods: [redirect] + +[source,ruby] +---- +# good +redirect('foo/%{bar_id}') +---- + +==== AllowedPatterns: [] (default) [source,ruby] ---- @@ -4401,7 +4483,7 @@ format('%06d', 10) redirect('foo/%{bar_id}') ---- -==== IgnoredMethods: [redirect] +==== AllowedPatterns: [/redirect/] [source,ruby] ---- @@ -4422,6 +4504,14 @@ redirect('foo/%{bar_id}') | `1` | Integer +| AllowedMethods +| `[]` +| Array + +| AllowedPatterns +| `[]` +| Array + | IgnoredMethods | `[]` | Array @@ -6267,8 +6357,8 @@ something.to_h { |v| [v, v * 2] } Enforces the presence (default) or absence of parentheses in method calls containing parameters. -In the default style (require_parentheses), macro methods are ignored. -Additional methods can be added to the `IgnoredMethods` +In the default style (require_parentheses), macro methods are allowed. +Additional methods can be added to the `AllowedMethods` or `AllowedPatterns` list. These options are valid only in the default style. Macros can be included by either setting `IgnoreMacros` to false or adding specific macros to @@ -6276,13 +6366,13 @@ the `IncludedMacros` list. Precedence of options is all follows: -1. `IgnoredMethods` +1. `AllowedMethods` 2. `AllowedPatterns` 3. `IncludedMacros` eg. If a method is listed in both -`IncludedMacros` and `IgnoredMethods`, then the latter takes -precedence (that is, the method is ignored). +`IncludedMacros` and `AllowedMethods`, then the latter takes +precedence (that is, the method is allowed). In the alternative style (omit_parentheses), there are three additional options. @@ -6330,7 +6420,7 @@ foo == bar # Setter methods don't need parens foo.bar = baz -# okay with `puts` listed in `IgnoredMethods` +# okay with `puts` listed in `AllowedMethods` puts 'test' # okay with `^assert` listed in `AllowedPatterns` @@ -6501,6 +6591,10 @@ Array 1 | `true` | Boolean +| AllowedMethods +| `[]` +| Array + | IgnoredMethods | `[]` | Array @@ -6556,8 +6650,8 @@ Array 1 Checks for unwanted parentheses in parameterless method calls. -This cop can be customized ignored methods with `IgnoredMethods`. -By default, there are no methods to ignored. +This cop can be customized allowed methods with `AllowedMethods`. +By default, there are no methods to allowed. === Examples @@ -6570,7 +6664,7 @@ object.some_method() object.some_method ---- -==== IgnoredMethods: [] (default) +==== AllowedMethods: [] (default) [source,ruby] ---- @@ -6578,7 +6672,7 @@ object.some_method object.foo() ---- -==== IgnoredMethods: [foo] +==== AllowedMethods: [foo] [source,ruby] ---- @@ -6591,6 +6685,14 @@ object.foo() |=== | Name | Default value | Configurable values +| AllowedMethods +| `[]` +| Array + +| AllowedPatterns +| `[]` +| Array + | IgnoredMethods | `[]` | Array @@ -8689,14 +8791,14 @@ Checks for usage of comparison operators (`==`, These can be replaced by their respective predicate methods. This cop can also be configured to do the reverse. -This cop can be customized ignored methods with `IgnoredMethods`. -By default, there are no methods to ignored. +This cop can be customized allowed methods with `AllowedMethods`. +By default, there are no methods to allowed. This cop disregards `#nonzero?` as its value is truthy or falsey, but not `true` and `false`, and thus not always interchangeable with `!= 0`. -This cop ignores comparisons to global variables, since they are often +This cop allows comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves `Integer` polymorphic. @@ -8738,7 +8840,7 @@ foo == 0 bar.baz > 0 ---- -==== IgnoredMethods: [] (default) with EnforcedStyle: predicate +==== AllowedMethods: [] (default) with EnforcedStyle: predicate [source,ruby] ---- @@ -8748,7 +8850,7 @@ foo == 0 bar.baz > 0 ---- -==== IgnoredMethods: [==] with EnforcedStyle: predicate +==== AllowedMethods: [==] with EnforcedStyle: predicate [source,ruby] ---- @@ -8760,6 +8862,29 @@ foo == 0 bar.baz > 0 ---- +==== AllowedPatterns: [] (default) with EnforcedStyle: comparison + +[source,ruby] +---- +# bad +foo.zero? +foo.negative? +bar.baz.positive? +---- + +==== AllowedPatterns: [/zero/] with EnforcedStyle: predicate + +[source,ruby] +---- +# good +# bad +foo.zero? + +# bad +foo.negative? +bar.baz.positive? +---- + === Configurable attributes |=== @@ -8769,6 +8894,14 @@ bar.baz > 0 | `predicate` | `predicate`, `comparison` +| AllowedMethods +| `[]` +| Array + +| AllowedPatterns +| `[]` +| Array + | IgnoredMethods | `[]` | Array @@ -12731,14 +12864,14 @@ Use symbols as procs when possible. If you prefer a style that allows block for method with arguments, please set `true` to `AllowMethodsWithArguments`. -respond_to , and `define_method?` methods are ignored by default. -These are customizable with `IgnoredMethods` option. +respond_to , and `define_method?` methods are allowed by default. +These are customizable with `AllowedMethods` option. === Safety This cop is unsafe because `proc`s and blocks work differently when additional arguments are passed in. A block will silently -ignore additional arguments, but a `proc` will raise +allow additional arguments, but a `proc` will raise an `ArgumentError`. For example: @@ -12816,7 +12949,7 @@ something.do_something do |s| # some comment end ---- -==== IgnoredMethods: [respond_to, define_method] (default) +==== AllowedMethods: [respond_to, define_method] (default) [source,ruby] ---- @@ -12825,6 +12958,22 @@ respond_to { |foo| foo.bar } define_method(:foo) { |foo| foo.bar } ---- +==== AllowedPatterns: [] (default) + +[source,ruby] +---- +# bad +something.map { |s| s.upcase } +---- + +==== AllowedPatterns: [/map/] (default) + +[source,ruby] +---- +# good +something.map { |s| s.upcase } +---- + === Configurable attributes |=== @@ -12834,10 +12983,18 @@ define_method(:foo) { |foo| foo.bar } | `false` | Boolean -| IgnoredMethods +| AllowedMethods | `respond_to`, `define_method` | Array +| AllowedPatterns +| `[]` +| Array + +| IgnoredMethods +| `[]` +| Array + | AllowComments | `false` | Boolean diff --git a/docs/modules/ROOT/pages/installation.adoc b/docs/modules/ROOT/pages/installation.adoc index 456622a0e3c5..8ceb15269d81 100644 --- a/docs/modules/ROOT/pages/installation.adoc +++ b/docs/modules/ROOT/pages/installation.adoc @@ -22,7 +22,7 @@ in your `Gemfile`: [source,rb] ---- -gem 'rubocop', '~> 1.32', require: false +gem 'rubocop', '~> 1.33', require: false ---- .A Modular RuboCop diff --git a/lib/rubocop/version.rb b/lib/rubocop/version.rb index d474ac930b27..71e7875d6094 100644 --- a/lib/rubocop/version.rb +++ b/lib/rubocop/version.rb @@ -3,7 +3,7 @@ module RuboCop # This module holds the RuboCop version information. module Version - STRING = '1.32.0' + STRING = '1.33.0' MSG = '%s (using Parser %s, ' \ 'rubocop-ast %s, ' \ diff --git a/relnotes/v1.33.0.md b/relnotes/v1.33.0.md new file mode 100644 index 000000000000..5d2fad45cf9c --- /dev/null +++ b/relnotes/v1.33.0.md @@ -0,0 +1,25 @@ +### Bug fixes + +* [#10830](https://github.com/rubocop/rubocop/issues/10830): Fix an incorrect autocorrect for `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: consistent` of `Layout/FirstArgumentIndentation` and enabling `Layout/FirstMethodArgumentLineBreak`. ([@koic][]) +* [#10825](https://github.com/rubocop/rubocop/issues/10825): Fix an incorrect autocorrect for `Style/ClassAndModuleChildren` when using nested one-liner class. ([@koic][]) +* [#10843](https://github.com/rubocop/rubocop/issues/10843): Fix a false positive for `Style/HashExcept` when using `reject` and calling `include?` method with symbol array and second block value. ([@koic][]) +* [#10853](https://github.com/rubocop/rubocop/pull/10853): Fix an autocorrect for `Style/RedundantSort` with logical operator. ([@ydah][]) +* [#10842](https://github.com/rubocop/rubocop/issues/10842): Make server mode aware of `CacheRootDirectory` config option value, `RUBOCOP_CACHE_ROOT`, and `XDG_CACHE_HOME` environment variables. ([@koic][]) +* [#10833](https://github.com/rubocop/rubocop/issues/10833): Fix an incorrect autocorrect for `Style/RedundantCondition` when branches contains arithmetic operation. ([@koic][]) +* [#10864](https://github.com/rubocop/rubocop/issues/10864): Fix a false positive for `Style/SymbolProc` when using `Hash#reject`. ([@koic][]) +* [#10771](https://github.com/rubocop/rubocop/issues/10771): Make server mode aware of `--cache-root` command line option. ([@koic][]) +* [#10831](https://github.com/rubocop/rubocop/pull/10831): Fix an error when using `changed_parameters` in obsoletion.yml by external library. ([@koic][]) +* [#10850](https://github.com/rubocop/rubocop/pull/10850): Fix `Style/ClassEqualityComparison` autocorrection within module. ([@r7kamura][]) +* [#10832](https://github.com/rubocop/rubocop/issues/10832): Fix an incorrect autocorrect for `Layout/BlockEndNewline` when multiline block `}` is not on its own line and using heredoc argument. ([@koic][]) + +### Changes + +* [#10841](https://github.com/rubocop/rubocop/pull/10841): Don't hash shared libraries for cache key. ([@ChrisBr][]) +* [#10862](https://github.com/rubocop/rubocop/pull/10862): Add autocorrection to `Lint/EmptyConditionalBody`. ([@dvandersluis][]) +* [#10829](https://github.com/rubocop/rubocop/pull/10829): Deprecate `IgnoredMethods` option in integrate to `AllowedMethods` and `AllowedPatterns` option. ([@ydah][]) + +[@koic]: https://github.com/koic +[@ydah]: https://github.com/ydah +[@r7kamura]: https://github.com/r7kamura +[@ChrisBr]: https://github.com/ChrisBr +[@dvandersluis]: https://github.com/dvandersluis