-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
- Fix an error when using heredoc with non-word delimiters #987
Merged
iliabylich
merged 1 commit into
whitequark:master
from
koic:fix_an_error_when_using_heredoc_with_non_word_delimiters
Jan 7, 2024
Merged
- Fix an error when using heredoc with non-word delimiters #987
iliabylich
merged 1 commit into
whitequark:master
from
koic:fix_an_error_when_using_heredoc_with_non_word_delimiters
Jan 7, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I've found whitequark#986 regression in the following RuboCop CI matrix: https://github.com/rubocop/rubocop/actions/runs/7437077900/job/20234293932?pr=12598 So, whitequark#986 was not a sufficient fix. This PR fixes an error when using heredoc with non-word delimiters: ```ruby <<~'+' foo + ``` The following repro test have been newly added: ```console $ bundle exec ruby -Itest test/test_lexer.rb (snip) 1) Error: TestLexer#test_heredoc_plus_character: RegexpError: target of repeat operator is not specified: /+\z/ /Users/koic/src/github.com/whitequark/parser/lib/parser/lexer/literal.rb:250:in `delimiter?' /Users/koic/src/github.com/whitequark/parser/lib/parser/lexer/literal.rb:138:in `nest_and_try_closing' /Users/koic/src/github.com/whitequark/parser/lib/parser/lexer-strings.rb:4165:in `advance' /Users/koic/src/github.com/whitequark/parser/lib/parser/lexer-F1.rb:11369:in `advance' test/test_lexer.rb:81:in `assert_scanned' test/test_lexer.rb:1001:in `test_heredoc_plus_character' ```
koic
force-pushed
the
fix_an_error_when_using_heredoc_with_non_word_delimiters
branch
from
January 7, 2024 09:27
bebc50e
to
dbed657
Compare
koic
added a commit
to koic/rubocop
that referenced
this pull request
Jan 7, 2024
Pending two specs until the following error in Parser 3.3.0.1 is resolved. whitequark/parser#987
8 tasks
koic
deleted the
fix_an_error_when_using_heredoc_with_non_word_delimiters
branch
January 7, 2024 14:40
Thanks, I've released |
koic
added a commit
to koic/rubocop
that referenced
this pull request
Jan 7, 2024
Ruby 3.3 and Parser 3.3.0.2 have been released. - https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released - https://rubygems.org/gems/parser/versions/3.3.0.2 This PR requires Parser 3.3.0.2 or higher and removes "experimental" label from support matrix. The Parser gem specifies version 3.3.0.2+, not 3.3.0.0, as it applies the following patch: whitequark/parser#987
koic
added a commit
to koic/rubocop
that referenced
this pull request
Jan 7, 2024
Ruby 3.3 and Parser 3.3.0.2 have been released. - https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released - https://rubygems.org/gems/parser/versions/3.3.0.2 This PR requires Parser 3.3.0.2 or higher and removes "experimental" label from support matrix. The Parser gem specifies version 3.3.0.2+, not 3.3.0.0, as it applies the following patch: whitequark/parser#987
8 tasks
Subramanya-Murugesan
added a commit
to Subramanya-Murugesan/rubocop
that referenced
this pull request
Feb 23, 2024
commit 2a864701d66808b93d57095a5d2fe503b1b21e4c Author: Koichi ITO <[email protected]> Date: Fri Feb 23 19:53:28 2024 +0900 [Docs] Tweak the doc for `Style/ConditionalAssignmentHelper` This PR tweaks the doc for `Style/ConditionalAssignmentHelper`. In #2480, the cop has been updated to also support comparison of variables. commit 1d4303567c58161335bf6729e5e0c3aa4f1e1a6c Author: Koichi ITO <[email protected]> Date: Thu Feb 22 19:55:36 2024 +0900 Tweak offense range for `Lint/RedundantSafeNavigation` commit 1666278a8587bb9982fcdb198c1395fd9af93f50 Author: Koichi ITO <[email protected]> Date: Wed Feb 21 21:06:30 2024 +0900 Support autocorrect for `InternalAffairs/MethodNameEndWith` commit 876a49d6fb3e0060c734eb40cd6660adf63cf77e Author: Koichi ITO <[email protected]> Date: Tue Feb 20 17:33:15 2024 +0900 [Docs] Add `--display-time` to the Basic Usage doc commit 2b013e123485102a790e44fc0b934aae1c625f6a Author: Koichi ITO <[email protected]> Date: Sat Feb 17 23:23:41 2024 +0900 Support searching for `rubocop/config.yml` in compliance with dot-config Follow https://github.com/rubocop/rubocop/pull/12700#issuecomment-1949764386 This PR supports searching for `rubocop/config.yml` in compliance with dot-config. This PR adds `project_root/.config/rubocop/config.yml` to the list of paths to search, matching XDG path format of the already targeted `~/.config/rubocop/config.yml`. However, support for `~/.config/rubocop.yml` is not included in this PR, as the outcome of inquiry https://github.com/dot-config/dot-config.github.io/issues/17 regarding it is still pending. commit 4478266e98f326ea36e173977d4e1eb6643371cc Author: Koichi ITO <[email protected]> Date: Mon Feb 19 15:55:39 2024 +0900 Fix false positives for `InternalAffairs/MethodNameEndWith` This PR fixes false positives for `InternalAffairs/MethodNameEndWith` when using `method_name` without receiver and resolves the following `rubocop:todo`. ```console $ bundle exec rubocop -a (snip) Offenses: lib/rubocop/cop/naming/predicate_name.rb:102:43: W: [Corrected] Lint/RedundantCopDisableDirective: Unnecessary disabling of InternalAffairs/MethodNameEndWith. method_name.end_with?('=') || # rubocop:todo InternalAffairs/MethodNameEndWith ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lib/rubocop/cop/naming/predicate_name.rb:112:61: W: [Corrected] Lint/RedundantCopDisableDirective: Unnecessary disabling of InternalAffairs/MethodNameEndWith. new_name << '?' unless method_name.end_with?('?') # rubocop:todo InternalAffairs/MethodNameEndWith ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` `method_name` without receiver or variable is a string object rather than a node object. commit b5cccc7130920151e120b3a5d9b68ca825a5a8b4 Merge: 974672714 dc74ac8d7 Author: Koichi ITO <[email protected]> Date: Sun Feb 18 00:24:58 2024 +0900 Merge pull request #12697 from koic/fix_an_error_for_style_case_like_if [Fix #12690] Fix an error for `Style/CaseLikeIf` commit 97467271431cf6db6a134b4398fe8f09db8bbb31 Author: Koichi ITO <[email protected]> Date: Sat Feb 17 03:25:43 2024 +0900 [Fix #12699] Support searching for `.rubocop.yml` in compliance with dot-config Resolves #12699 This PR supports searching for `.rubocop.yml` in compliance with dot-config. [dot-config](https://dot-config.github.io/) prioritizes project-specific configurations over user-specific configurations, with a search order that first looks for the `.rubocop.yml` within the project's directories, in accordance with dot-config standards, before considering user-specific configurations. commit 948a6ed6fcd431d9d02c68e3199d77468e0dbcc5 Merge: e8df84bd8 f89412f1e Author: Koichi ITO <[email protected]> Date: Sat Feb 17 01:35:54 2024 +0900 Merge pull request #12696 from koic/fix_an_incorrect_for_style_object_then [Fix #12693] Fix an incorrect autocorrect for `Style/ObjectThen` commit e8df84bd8a3eff5e6ed29bcabd58525befb30e1d Merge: 7b8726132 efa4eb839 Author: Koichi ITO <[email protected]> Date: Fri Feb 16 23:31:00 2024 +0900 Merge pull request #12698 from koic/fix_error_for_style_multiline_ternary_operator [Fix #12691] Fix an error for `Style/MultilineTernaryOperator` commit efa4eb8398c6a512813987150b2260b32cf1c987 Author: Koichi ITO <[email protected]> Date: Fri Feb 16 21:32:18 2024 +0900 [Fix #12691] Fix an error for `Style/MultilineTernaryOperator` Fixes #12691. This PR fixes an error for `Style/MultilineTernaryOperator` when nesting multiline ternary operators. commit dc74ac8d773ea1526aacc0975755b3067ae60aae Author: Koichi ITO <[email protected]> Date: Fri Feb 16 11:32:33 2024 +0900 [Fix #12690] Fix an error for `Style/CaseLikeIf` Fixes #12690. This PR fixes an error for `Style/CaseLikeIf` when using `==` with literal and using ternary operator. commit f89412f1e0b29d052a4ad219e286565d14ea77bd Author: Koichi ITO <[email protected]> Date: Fri Feb 16 11:04:23 2024 +0900 [Fix #12693] Fix an incorrect autocorrect for `Style/ObjectThen` Fixes #12693. This PR fixes an incorrect autocorrect for `Style/ObjectThen` when using `yield_self` without receiver. commit 7b8726132be1148d625a2005f283aa4c761fab92 Author: Koichi ITO <[email protected]> Date: Thu Jan 25 02:34:27 2024 +0900 [Fix #12649] Fix false positives for `Style/InverseMethods` Fixes #12649. This PR fixes false positives for `Style/InverseMethods` when using relational comparison operator with safe navigation. commit d4afee6fb41a619836b8bb201ba5594710a7900f Author: Koichi ITO <[email protected]> Date: Thu Feb 15 12:06:59 2024 +0900 [Fix #12687] Fix a false positive for `Lint/Void` Fixes #12687. This PR fixes a false positive for `Lint/Void` when `each` block with conditional expressions that has multiple statements. commit d8d8474edf63e4b60ec4b72cd78941520f977d44 Author: Koichi ITO <[email protected]> Date: Tue Feb 13 23:16:42 2024 +0900 Add new `InternalAffairs/RedundantExpectOffenseArguments` cop This PR adds new `InternalAffairs/RedundantExpectOffenseArguments` cop, which checks for redundant arguments of `RuboCop::RSpec::ExpectOffense`'s methods. ```ruby # bad expect_no_offenses('code', keyword: keyword) # good expect_no_offenses('code') ``` commit 1acdaefb146c472ed92919444bccdb88cdade099 Merge: 1dac6a4e2 29c47f82c Author: Koichi ITO <[email protected]> Date: Wed Feb 14 00:02:54 2024 +0900 Merge pull request #12684 from koic/fix_an_incorrect_autocorrect_for_style_map_compact_with_conditional_block [Fix #12683] Fix an incorrect autocorrect for `Style/MapCompactWithConditionalBlock` commit 29c47f82cb1c8d4939a7ea20ac2dab10b6153551 Author: Koichi ITO <[email protected]> Date: Tue Feb 13 09:55:43 2024 +0900 [Fix #12683] Fix an incorrect autocorrect for `Style/MapCompactWithConditionalBlock` Fixes #12683 This PR fixes an incorrect autocorrect for `Style/MapCompactWithConditionalBlock` when using guard clause with `next` implicitly nil. It also fixes the incorrect test code. commit 1dac6a4e20ab8b66bf0c0269b085a4191c0fce98 Author: Koichi ITO <[email protected]> Date: Mon Feb 12 01:01:22 2024 +0900 Add `--editor-mode` CLI option Follow up https://github.com/rubocop/rubocop/pull/12657#issuecomment-1937084864. This PR adds `--editor-mode` CLI option, which optimize real-time feedback in editors, adjusting behaviors for editing experience. Editors that run RuboCop directly (e.g., by shelling out) encounter the same issues as with `--lsp`. This option is designed for such editors. commit 772054e2d3dc3f9a55e0de9bb0d1262be71019f8 Author: Koichi ITO <[email protected]> Date: Sun Jan 28 17:16:01 2024 +0900 Support `AutoCorrect: contextual` option for LSP ## Summary This PR introduces `AutoCorrect: contextual` option that prevents autocorrection during typing in LSP. This option extends the existing `AutoCorrect` parameter. - Before: `AutoCorrect: true` or `AutoCorrect: false` - After: `AutoCorrect: always`, `AutoCorrect: disabled`, or `AutoCorrect: contextual` Note, `AutoCorrect: always` maintains compatibility with `AutoCorrect: true`, and `AutoCorrect: disabled` maintains compatibility with `AutoCorrect: false`. ## Details For example, `Style/EmptyMethod` should not autocorrect to one-liner while in the process of writing the body of the method. This isn't an issue with autocorrection itself, but rather due to differing requirements in contexts such as editing (LSP) and command line (e.g., CI). So, `AutoCorrect: contextual` is set for some cops like this. There may be other cases, but for the obvious following cops. The classification is as follows: ### Cops that might remove code being edited - `Layout/EmptyComment` cop - `Lint/EmptyConditionalBody` cop - `Lint/EmptyEnsure` cop - `Lint/EmptyInterpolation` cop - `Lint/TrailingCommaInAttributeDeclaration` cop - `Lint/UselessAccessModifier` cop - `Lint/UselessAssignment` cop - `Lint/UselessMethodDefinition` cop - `Lint/UselessTimes` cop - `Lint/Void` cop - `Style/EmptyElse` cop - `Style/RedundantInitialize` cop ### Cops that might adjust code being edited - `Lint/UnusedBlockArgument` cop - `Lint/UnusedMethodArgument` cop - `Style/EmptyHeredoc` cop - `Style/EmptyMethod` cop As a result, it allows for a distinction in the use of autocorrection between the LSP and command-line contexts. ## Other Information Here is why the parameter name was chosen as `contextual`. In this PR, autocorrection from LSP is always not applied in the case of `contextual`. However, even when `contextual` is set, I was considering a possibility for autocorrection to be forcibly applied from LSP under certain conditions. Therefore, the initial thought was to name it `contextual`, but it might have been too abstract in context, so it was changed to `contextual`. commit 8b3656d6e5e5685dc28dc8c57efa19ee2e9092f0 Author: Koichi ITO <[email protected]> Date: Sun Feb 11 02:09:05 2024 +0900 Avoid redundant `parse` for `Style/RedundantArgument` This PR avoids redundant repetitive `parse` for `Style/RedundantArgument`. Similar to #12677 and #12678, there is no need to parse code that has already been parsed once. commit f9a6d2d973d9bb9b78fe4e9c11538bece53f043f Merge: 81ccef985 9e3bf052c Author: Koichi ITO <[email protected]> Date: Sat Feb 10 03:12:25 2024 +0900 Merge pull request #12680 from koic/pending_a_options_spec_when_ruby34 Make an options_spec as pending when using Ruby 3.4.0dev commit 9e3bf052cef32eeb770db15ceb8f3cf2334cc5c7 Author: Koichi ITO <[email protected]> Date: Sat Feb 10 02:25:15 2024 +0900 Make an options_spec as pending when using Ruby 3.4.0dev This PR makes the following options_spec as pending when using Ruby 3.4.0dev. ```console $ ruby -v ruby 3.4.0dev (2024-02-09T12:28:26Z master 08b77dd682) [x86_64-darwin23] $ bundle exec rspec './spec/rubocop/options_spec.rb[1:1:1:2]' (snip) 1 example, 1 failure Failed examples: rspec ./spec/rubocop/options_spec.rb:29 # RuboCop::Options option -h/--help shows help text ``` https://github.com/rubocop/rubocop/actions/runs/7845618444/job/21410458812?pr=12657 The pending spec should be update to behavior in accordance with the inquiry results of https://bugs.ruby-lang.org/issues/20252. commit 81ccef985a914f647e36bc956ea8c14755858d82 Author: Koichi ITO <[email protected]> Date: Wed Feb 7 00:34:41 2024 +0900 Fix an error for `Style/RedundantLineContinuation` when using `Prism::Translation::Parser` This PR fixes the following error `Style/RedundantLineContinuation` when using `Prism::Translation::Parser` as a parser: ```console $ bundle exec ruby -rprism/translation/parser/rubocop $(bundle exec which rubocop) (snip) An error occurred while Style/RedundantLineContinuation cop was inspecting /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb. undefined method `complete?' for an instance of AST::Node /Users/koic/src/github.com/rubocop/rubocop-ast/lib/rubocop/ast/node.rb:104:in `block in initialize' ``` This is a similar error to #12677. commit 775852c35e14db23f4a65ab9a1c6cd2b0692832f Author: Koichi ITO <[email protected]> Date: Fri Feb 2 00:44:00 2024 +0900 [Fix #12273] Make `OffenseCountFormatter` display autocorrection info Fixes #12273. This PR makes `OffenseCountFormatter` display autocorrection information. This solves the use case of checking and selectively applying cops that support autocorrection when there are some unresolved offenses. Although it may be possible to provide an option, finding use cases for making them optional seems unlikely. Therefore, the new autocorrection information will always be displayed. commit 6b516d01e7c0958441ef03abb903fab454d757ac Author: Koichi ITO <[email protected]> Date: Mon Feb 5 12:55:28 2024 +0900 Fix false negatives for `Lint/RedundantSafeNavigation` This is similar to detection #12246. This PR fixes false negatives for `Lint/RedundantSafeNavigation` when using safe navigation operator for literal receiver. commit 3f9a75aebcc28f11d8e3a93ae3e14c3f64a75136 Author: Koichi ITO <[email protected]> Date: Fri Feb 9 01:29:29 2024 +0900 Publish `RuboCop::LSP.enable` to enable LSP mode `RuboCop::Cop::Base.enable_lsp_mode` will be renamed to `RuboCop::LSP.enable`. Before: ```ruby RuboCop::Cop::Base.enable_lsp_mode ``` After: ```ruby RuboCop::LSP.enable ``` This is because whether or not it is LSP should not be set per cop but should be a state controlled for the entire RuboCop process. Since `RuboCop::Cop::Base.enable_lsp_mode` was an experimental private API, it will be renamed without a deprecation warning. Along with this, the module name has been changed from `RuboCop::Lsp` to `RuboCop::LSP`. This change is made to align with Ruby's standard API, like `RubyVM::YJIT.enable`, making it `RuboCop::LSP.enable` instead. `RuboCop::Lsp.enable` does not look as pretty name. With the renaming to `RuboCop::LSP.enable`, the usage of this API will be documented. This allows libraries like Ruby LSP and Solargraph, which use internal modules other than RuboCop's built-in `RuboCop::LSP::Server#start`, to easily utilize the features in #12586 and #12657. commit dc50e8034183646f05e7009e917a452ec1f7ba7e Author: Koichi ITO <[email protected]> Date: Thu Feb 8 11:05:04 2024 +0900 Remove `base64` development dependency from Gemfile WebMock 3.20.0 has been released: https://github.com/bblimke/webmock/blob/master/CHANGELOG.md#3200 So, reverts https://github.com/rubocop/rubocop/pull/12317. commit 9b87c88c02c0b0f7c1c39f21c5f1000d286d245f Merge: 1488e1ff7 42e46805b Author: Koichi ITO <[email protected]> Date: Wed Feb 7 16:01:09 2024 +0900 Merge pull request #12674 from koic/fix_false_negative_for_style_redundant_return Fix false negatives for `Style/RedundantReturn` commit 1488e1ff7b499664596040ce8a6d15e41aa97e53 Author: Koichi ITO <[email protected]> Date: Tue Feb 6 21:56:55 2024 +0900 Fix an error for `Style/HashSyntax` when using `Prism::Translation::Parser` This PR fixes the following error `Style/HashSyntax` when using `Prism::Translation::Parser` as a parser: ```console $ bundle exec ruby -rprism/translation/parser/rubocop $(bundle exec which rubocop) \ --only Style/HashSyntax -d lib/rubocop/cop/style/not.rb (snip) An error occurred while Style/HashSyntax cop was inspecting /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/style/not.rb:23:27. undefined method `loc' for an instance of AST::Node /Users/koic/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/parser-3.3.0.5/lib/parser/builders/default.rb:1875: in `join_exprs' ``` Other ways to resolve this might exist, but using `RuboCop::Cop::Base#parser` is not necessary. Currently, no repro tests have been added as it is sufficient to verify that it is not broken with the Parser gem. And, this is for refactoring aimed at integration with `Prism`, no changelog entry will be added. cf. https://github.com/ruby/prism/blob/v0.21.0/docs/parser_translation.md#rubocop commit 42e46805b1f303c5ab65f5961b4b3f4fb2b09027 Author: Koichi ITO <[email protected]> Date: Tue Feb 6 01:02:32 2024 +0900 Fix false negatives for `Style/RedundantReturn` This PR fixes false negatives for `Style/RedundantReturn` when using pattern matching. commit 3a03c799f2a69b81885ad8a982b1481d5ef1dc44 Author: Koichi ITO <[email protected]> Date: Mon Feb 5 21:37:56 2024 +0900 Use `Range#join` instead of generic `Parser::Source::Range.new` This commit replaces the generic and verbose `Parser::Source::Range.new` with the dedicated API. commit c3ea782e490a7c7f1eb955459f010216194bf750 Author: Koichi ITO <[email protected]> Date: Sun Feb 4 17:26:01 2024 +0900 Fix a typo commit 81b5d3eae698ff6296235e9c4917136257ab1baa Merge: 3f24b822a 5307cec0f Author: Koichi ITO <[email protected]> Date: Sat Feb 3 00:17:38 2024 +0900 Merge pull request #12670 from koic/fix_an_incorrect_autocorrect_for_lint_empty_conditional_body [Fix #12668] Fix an incorrect autocorrect for `Lint/EmptyConditionalBody` commit 5307cec0f4a8db592b6308da4ed0e913638563d3 Author: Koichi ITO <[email protected]> Date: Fri Feb 2 09:57:06 2024 +0900 [Fix #12668] Fix an incorrect autocorrect for `Lint/EmptyConditionalBody` Fixes #12668. This PR fixes an incorrect autocorrect for `Lint/EmptyConditionalBody` when missing `if` body with conditional `else` body. commit 3f24b822a37f08e54a3e076e3a091f808adc6fa9 Author: Koichi ITO <[email protected]> Date: Thu Feb 1 01:13:28 2024 +0900 [Docs] Update the doc for `Layout/EndAlignment` commit 36a6b885448c3f5c1652345d9afdc3cce5edd79b Author: Koichi ITO <[email protected]> Date: Wed Jan 31 13:07:04 2024 +0900 Use `ProcessedSource#file_path` commit c27c74ef47b955fab6ccb844f19e4db44ca7217a Merge: 573b23bda 841b18d9f Author: Koichi ITO <[email protected]> Date: Tue Jan 30 11:26:20 2024 +0900 Merge pull request #12659 from kiskoza/remove-bigdecimal-fixme Resolve Fixme in Gemfile, remove bigdecimal commit 841b18d9f738a6fb0ab44f23623f03ac81e37d0d Author: Koza <[email protected]> Date: Mon Jan 29 20:05:14 2024 +0100 Resolve Fixme in Gemfile, remove bigdecimal This is a follow up on https://github.com/rubocop/rubocop/pull/12153 . The mentioned PR was merged in to `crack` and released as v0.4.6 commit 573b23bdaec2e0cc4787764117ae1fc38bfeaff5 Author: Maruth Goyal <[email protected]> Date: Mon Jan 22 11:28:39 2024 -0800 Update error message on incorrect badge commit b6ee1c20a553e13c404b0b48137a17120a64e176 Author: Koichi ITO <[email protected]> Date: Mon Jan 29 00:17:05 2024 +0900 Tweak an error message of `ConfigValidator` This PR tweaks an error message of `ConfigValidator` when the config is invalid: ## Before ```console $ bundle exec rake update_cops_documentation (snip) rake aborted! RuboCop::ValidationError: Property AutoCorrect of cop Layout/EmptyComment is supposed to be a boolean and on_command is not. (RuboCop::ValidationError) ``` ## After ```console $ bundle exec rake update_cops_documentation (snip) rake aborted! RuboCop::ValidationError: Property AutoCorrect of Layout/EmptyComment cop is supposed to be a boolean and on_command is not. (RuboCop::ValidationError) ``` commit bededcc93132938aeb10b885d7056bea87c4f3eb Merge: d1746bedd a3a30d454 Author: Koichi ITO <[email protected]> Date: Sun Jan 28 09:45:05 2024 +0900 Merge pull request #12656 from koic/fix_error_for_layout_redundant_line_break Fix an error for `Layout/RedundantLineBreak` commit a3a30d4545a079a525e0ba23ce45b10326177f41 Author: Koichi ITO <[email protected]> Date: Sat Jan 27 17:32:07 2024 +0900 Fix an error for `Layout/RedundantLineBreak` This PR fixes the following error for `Layout/RedundantLineBreak` when using index access call chained on multiline hash literal: ```console $ cat example.rb { key: value }[key] $ bundle exec rubocop --only Layout/RedundantLineBreak -a -d (snip) An error occurred while Layout/RedundantLineBreak cop was inspecting /tmp/example.rb:1:0. undefined method `method?' for an instance of RuboCop::AST::HashNode /Users/koic/src/github.com/rubocop/rubocop/lib/rubocop/cop/layout/redundant_line_break.rb:92:in `index_access_call_chained?' ``` commit d1746bedda902662d2d2fc5225982dca936990e0 Merge: 3e31e45c3 02b2c3a46 Author: Koichi ITO <[email protected]> Date: Sat Jan 27 01:51:49 2024 +0900 Merge pull request #12645 from jenshenny/change-source-order Check gemspec `required_ruby_version` before `.ruby-version` and other sources commit 3e31e45c3eb7395be601e0b27ead885b4074046a Author: Koichi ITO <[email protected]> Date: Fri Jan 26 10:07:35 2024 +0900 Revert "Add default tags to issue templates" Reverts #12644. It's been a few days since the introduction, but there are false reports of the "bug" label being applied to items that are not confirmed as bugs or are not bugs. The default "bug" label is confusing for unconfirmed feedback. Despite considering user likelihood to change labels, submissions are often made with the default. For feature request, sometimes labels other than "enhancement", like "feature" or others, are more appropriate. Labeling can suit mechanical operations (e.g., bot), but may not fit uncertain feedback needing review, as seen in this repository. To avoid misleading labels on unresolved issues, the default labels will be removed from the issue template for maintenance reasons. commit 02b2c3a461f197134cb1d7e1bf693c4e3902e8de Author: Jenny Shen <[email protected]> Date: Tue Jan 23 15:16:58 2024 -0500 Check gemspec source after rubocop config commit 02e1ab0212733142b69cb3148c4f92f83bd96fdb Author: Koichi ITO <[email protected]> Date: Fri Jan 26 01:50:30 2024 +0900 Add `AutoCorrect` param to non display keys of generated doc Currently, `AutoCorrect` parameter is not configured, therefore there's no problem. But, this parameter should probably be ignored, similar to `SafeAutoCorrect`. commit 91bc38c7306adb07c62129db1614f67b941685b9 Merge: b4080d8ef 5d818a96d Author: Koichi ITO <[email protected]> Date: Thu Jan 25 11:54:20 2024 +0900 Merge pull request #12648 from gsamokovarov/omit-parens-1-60-issues Fix numblock regressions in `omit_parentheses` Style/MethodCallWithArgsParentheses` commit 5d818a96d69c5062e7beb20314b9f28957d67f5f Author: Genadi Samokovarov <[email protected]> Date: Wed Jan 24 17:50:00 2024 +0200 Fix numblock regressions in `omit_parentheses` Style/MethodCallWithArgsParentheses My last change was trying to fix an edge case where RuboCop wanted us to remove parentheses in the following example, but removing the parens was resulting in a `SyntaxError`: ```ruby AnyCable.middleware.use( Class.new(AnyCable::Middleware) do ^^^^^^^^^^^^^^^^^^^^^^ Omit parentheses for method calls with arguments. pass end ) ``` As it often happens, though, I broke a few other cases where we now want to remove parens, while the removal can result in ambiguous code: **Case 1** ```ruby Foo::Bar.find(pending.things.map { _1['code'] }) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Omit parentheses for method calls with arguments. ``` While we can remove the parentheses in *Case 1*, the author has to be well aware of the difference between the do/end and braced blocks method bounding semantics. Allowing the author to put the parens can remove this ambiguity and we used to allow it. **Case 2** ```ruby [a, b].map { _1.call 'something' }.uniq.join(' - ') ^^^^^^^ Omit parentheses for method calls with arguments. ``` If we set `AllowParenthesesInChaining: true`, we should allow parentheses in chained calls. However, this is broken in current RuboCop. Both of the issues were caused by a 'refactoring' that forgot to check argument calls or chaining with `numblocks` specifically. commit b4080d8efc42466f31c63a443157363b11a467f7 Author: Koichi ITO <[email protected]> Date: Wed Jan 24 16:57:31 2024 +0900 LSP mode configurable from external source The original LSP mode determination relied on the `--lsp` command-line argument, making it hard to set the mode from 3rd party LSP(-like) tools. This PR refines the API to resolve this issue. Additionally, as a side effect, it improves the mocking part of spec. However, the APIs are still experimental and not yet mature. commit 8a000a304090740fd599a86e63dc8b0d81f176bf Author: Bozhidar Batsov <[email protected]> Date: Wed Jan 24 14:07:28 2024 +0200 Add back :windows as a platform for bigdecimal It was breaking bundler locally for me with the following error: [!] There was an error parsing `Gemfile`: `windows` is not a valid platform. The available options are: [:ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25, :ruby_26, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :mri_25, :mri_26, :rbx, :truffleruby, :jruby, :jruby_18, :jruby_19, :mswin, :mswin_18, :mswin_19, :mswin_20, :mswin_21, :mswin_22, :mswin_23, :mswin_24, :mswin_25, :mswin_26, :mswin64, :mswin64_19, :mswin64_20, :mswin64_21, :mswin64_22, :mswin64_23, :mswin64_24, :mswin64_25, :mswin64_26, :mingw, :mingw_18, :mingw_19, :mingw_20, :mingw_21, :mingw_22, :mingw_23, :mingw_24, :mingw_25, :mingw_26, :x64_mingw, :x64_mingw_20, :x64_mingw_21, :x64_mingw_22, :x64_mingw_23, :x64_mingw_24, :x64_mingw_25, :x64_mingw_26]. Bundler cannot continue. # from /home/bozhidar/projects/rubocop/Gemfile:30 # ------------------------------------------- # # is merged and released. It's a workaround until then. > gem 'bigdecimal', platform: %i[mri windows] # gem 'webmock', require: false # ------------------------------------------- Seems this works on MigGW, though. commit 1f277665d506b65f1c3819e0229ebe70554d3ea6 Author: Bozhidar Batsov <[email protected]> Date: Wed Jan 24 13:42:55 2024 +0200 Reset the docs version commit fbf41c6b2f2a3b80f0c5bb91c65080888d1e6c1e Author: r7kamura <[email protected]> Date: Fri Jan 19 04:46:31 2024 +0900 Mark `Style/RaiseArgs` as unsafe commit edb56c927d4d1112a9c02990da31767e68d2121c Author: Bozhidar Batsov <[email protected]> Date: Wed Jan 24 13:32:45 2024 +0200 Cut 1.60.2 commit f00679b93e118a81d53cf97d6459e6498336b710 Author: Bozhidar Batsov <[email protected]> Date: Wed Jan 24 13:31:52 2024 +0200 Update Changelog commit 05730f51eb83c2eb681a2a7d578c7d1a79814072 Author: Koichi ITO <[email protected]> Date: Tue Jan 23 15:11:32 2024 +0900 Fix false positives for `Style/HashEachMethods` Fixes https://github.com/rubocop/rubocop/issues/12534#issuecomment-1871676010. This PR fixes false positives for `Style/HashEachMethods` when using array converter method. Hash object converted to an Array cannot process `Hash#each_key` and `Hash#each_value`. Therefore, if methods that convert to an Array are used before `each`, they should be ignored. commit c5a705279e2fccd339d6edb3e528464e5f401e78 Author: OKURA Masafumi <[email protected]> Date: Wed Jan 24 01:46:48 2024 +0900 Add default tags to issue templates commit 996c6be4b19a0b6819474df8639a95bf771b5d7b Author: Koichi ITO <[email protected]> Date: Wed Jan 17 01:30:07 2024 +0900 Update the Compatibility Policy This PR proposes to update the Compatibility Policy. There are major version incompatibilities between Ruby 2.7 and Ruby 3.0. And the latest stable version of Ruby on Rails, 7.1, still supports Ruby 2.7. So, dropping support for Ruby 2.7 from RuboCop might be premature for the market at this stage. At least for the duration that Rails 7.1 is classified as being in the "Bug Fix" phase under the [Maintenance Policy for Ruby on Rails] (https://guides.rubyonrails.org/maintenance_policy.html), RuboCop will continue to support Ruby 2.7. In reality, RuboCop is mostly used for code analysis with the same version of the Ruby runtime. I think that ensuring such users can smoothly upgrade their RuboCop version justifies maintaining support for older Ruby version 2.7 for an extended period. commit a6cf5a76dbad273a4695e40ca08533404840c6e5 Author: Koichi ITO <[email protected]> Date: Thu Jan 18 17:46:55 2024 +0900 [Fix #12632] Fix an infinite loop error for `Style/ArgumentsForwarding` Fixes #12632. This PR fixes an infinite loop error when `EnforcedStyle: explicit` of `Naming/BlockForwarding` with `Style/ArgumentsForwarding`. commit 60a9350687ea1120647bbc6b82c80407abb54644 Author: Koichi ITO <[email protected]> Date: Mon Jan 22 00:25:17 2024 +0900 [Fix #12638] Fix an `Errno::ENOENT` error when using server mode Fixes #12638. There is a possibility of a race condition occurring with the status file when using server mode. The status file is updated to a new status by `Cache.write_status_file` (`Pathname#write`), so there is no need to clear it by deleting the file. Due to the difficulty in reproducing this race conditions, test code for this have not been added. commit 96542aa6ff0446487e78bdb8b303bbb04f1eb06f Author: Koichi ITO <[email protected]> Date: Mon Jan 22 17:01:10 2024 +0900 [Docs] Tweak the "Template support" doc This commit prevents unintended hyphens from being displayed instead of highlights: https://docs.rubocop.org/rubocop/1.60/extensions.html#template-support commit c3921c0988d23c994a705eae08fc2c8983455106 Merge: 54c3f61a2 17f5fcff7 Author: Koichi ITO <[email protected]> Date: Sun Jan 21 14:06:46 2024 +0900 Merge pull request #12636 from Earlopain/fix-error-for-style-hash-each-methods Fix an error for `Style/HashEachMethods` when a block with both parameters has no body commit 17f5fcff76e4e3784d8e42f0c0cc82908f777042 Author: Earlopain <[email protected]> Date: Sat Jan 20 17:54:11 2024 +0100 Fix an error for `Style/HashEachMethods` when a block with both parameters has no body commit 54c3f61a2e3db697394652d11d52f6620b481f1e Merge: d4229d35b 210c4d361 Author: Koichi ITO <[email protected]> Date: Sun Jan 21 01:31:23 2024 +0900 Merge pull request #12635 from Earlopain/false-positive-for-style-hash-each-methods Fix a false positive for `Style/HashEachMethods` when both arguments are unused commit d4229d35bdf615d8222327c126860cdc916800a0 Author: Koichi ITO <[email protected]> Date: Sun Jan 21 01:13:17 2024 +0900 Fix false negatives for `InternalAffairs/ExampleDescription` Follow up https://github.com/rubocop/rubocop/pull/12624#discussion_r1454736589 This PR fixes false negatives for `InternalAffairs/ExampleDescription` when given an improper description with option. commit 4ad4b95c538a42c5d4eff48b34c83d8e8de02416 Merge: 20353dc2c 4b6ad5cbe Author: Koichi ITO <[email protected]> Date: Sat Jan 20 02:48:34 2024 +0900 Merge pull request #12628 from koic/fix_false_positive_for_style_arguments_forwarding Fix a false positive for `Style/ArgumentsForwarding` commit 20353dc2ced595d9faa7c31ff202e9bde8128cc5 Merge: 2b27ed86b 3cf1bce84 Author: Koichi ITO <[email protected]> Date: Fri Jan 19 02:25:08 2024 +0900 Merge pull request #12631 from koic/fix_a_false_positive_for_layout_redundant_line_break_cop [Fix #12627] Fix a false positive for `Layout/RedundantLineBreak` commit 210c4d361a749ea77766381983f605917e1109b6 Author: Earlopain <[email protected]> Date: Thu Jan 18 18:19:57 2024 +0100 Fix a false positive for `Style/HashEachMethods` when both arguments are unused. `Lint/UnusedBlockArgument` should instead say something about this: commit 3cf1bce84aba870f05b1c815e03b6491ab7a4772 Author: Koichi ITO <[email protected]> Date: Thu Jan 18 16:01:42 2024 +0900 [Fix #12627] Fix a false positive for `Layout/RedundantLineBreak` Fix #12627. This PR fixes a false positive for `Layout/RedundantLineBreak` when using index access call chained on multiple lines with backslash. commit 2b27ed86b5270715a70fa3899a586af9b5797388 Merge: 14119589b f8ccef6e0 Author: Koichi ITO <[email protected]> Date: Thu Jan 18 18:46:11 2024 +0900 Merge pull request #12634 from koic/fix_build_error_on_windows Fix a build error on windows mingw matrix commit f8ccef6e0f4a6d00a7621cc17391c95fe6aa9010 Author: Koichi ITO <[email protected]> Date: Thu Jan 18 18:17:15 2024 +0900 Fix a build error on windows mingw matrix This PR fixes the following build error on windows mingw matrix: ```console D:/a/rubocop/rubocop/vendor/bundle/ruby/3.4.0+0/gems/crack-0.4.5/lib/crack/xml.rb:9: warning: bigdecimal was loaded from the standard library, but is not part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. An error occurred while loading spec_helper. - Did you mean? rspec ./spec/spec_helper.rb Failure/Error: require 'webmock/rspec' LoadError: cannot load such file -- bigdecimal # ./vendor/bundle/ruby/3.4.0+0/gems/crack-0.4.5/lib/crack/xml.rb:9:in `<top (required)>' ``` https://github.com/rubocop/rubocop/actions/runs/7567518866/job/20606843322?pr=12633 This occurred due to BigDecimal has been extracted as a bundled gem: ruby/ruby#9573 commit 4b6ad5cbe3a0a58d2090afd6f69b841ac16a0d75 Author: Koichi ITO <[email protected]> Date: Thu Jan 18 10:42:07 2024 +0900 Fix a false positive for `Style/ArgumentsForwarding` Resolves https://github.com/rubocop/rubocop/issues/12618#issuecomment-1896303457. This PR fixes a false positive for `Style/ArgumentsForwarding` when using block arg forwarding with positional arguments forwarding to within block. commit 14119589b2e3a7be13f2542ad9ae0d3515fdda76 Author: Koichi ITO <[email protected]> Date: Thu Jan 18 02:25:41 2024 +0900 Fix a false positive for `Style/ArgumentsForwarding` Fixes https://github.com/rubocop/rubocop/issues/12618#issuecomment-1896227199. This PR fixes a false positive for `Style/ArgumentsForwarding` when naming a block argument `&`. commit f0e89c976cd56330b4f95c82dc4f9aacacfeff25 Author: Bozhidar Batsov <[email protected]> Date: Wed Jan 17 18:00:24 2024 +0200 Reset docs version commit 1f507c9a4fbde88058e504480b7ca2864b7aacd3 Author: Bozhidar Batsov <[email protected]> Date: Wed Jan 17 17:59:30 2024 +0200 Cut 1.60.1 commit 356b6cb91cc9b06d334ab225e9132df0307277dd Author: Bozhidar Batsov <[email protected]> Date: Wed Jan 17 17:58:55 2024 +0200 Update Changelog commit 936895d67bf119abf4c08610005661c32d31422f Author: Koichi ITO <[email protected]> Date: Wed Jan 17 13:30:01 2024 +0900 [Fix #12618] Fix false positives for `Style/ArgumentsForwarding` Fixes #12618, #12619, #12620, and #12621. This PR fixes false positives for `Style/ArgumentsForwarding` when using block argument forwarding with other arguments. And this PR makes `Style/ArgumentsForwarding` aware only block argument forwarding when using Ruby 3.1+. commit 927a220b72700093b42f9df09d0148969fd5a9ba Merge: ef7f54ecd d0dccdd71 Author: Koichi ITO <[email protected]> Date: Wed Jan 17 20:55:10 2024 +0900 Merge pull request #12625 from Strzesia/handle-errno-erofs-exception Add Errno::EROFS exception handling for read-only file systems commit d0dccdd71f759573335658e706937c96be2b308a Author: Strzesia <[email protected]> Date: Wed Jan 17 10:47:13 2024 +0100 Add Errno::EROFS exception handling for read-only file systems commit ef7f54ecd48b72e10c93bc509bceae2276ae035b Author: Koichi ITO <[email protected]> Date: Tue Jan 16 17:44:40 2024 +0900 [Fix #12617] Make `Style/CollectionCompact` aware of `grep_v` with nil Resolves #12617. This PR makes `Style/CollectionCompact` aware of `grep_v` with nil. commit f4cc2921bf5691b62507f81fbffcbb427d7a68be Author: Koichi ITO <[email protected]> Date: Tue Jan 16 00:06:42 2024 +0900 [Fix #12614] Fix false positiveis for `Style/RedundantParentheses` Fixes #12614. This PR fixes false positiveis for `Style/RedundantParentheses` when parentheses in control flow keyword with multiline style argument. commit ce906c679e225b5f434950e2991a64a0534aea13 Author: Koichi ITO <[email protected]> Date: Tue Jan 16 00:37:35 2024 +0900 Switch back the docs version commit 56e88bb824fa4699b0e7d6af22afd8943daf8d84 Author: Bozhidar Batsov <[email protected]> Date: Mon Jan 15 09:53:35 2024 +0200 Cut 1.60 commit 84ee480111ac430c91535d49b01f24ba115d07a9 Author: Bozhidar Batsov <[email protected]> Date: Mon Jan 15 09:53:11 2024 +0200 Update Changelog commit 6a83571276cd95a1ff4d4065cb5381789559c23f Author: Koichi ITO <[email protected]> Date: Mon Jan 15 12:58:18 2024 +0900 Remove useless `require fileutils` commit d58940bb6ab5c88dd8b3aa73217cbd0588cfa01d Author: Koichi ITO <[email protected]> Date: Sun Jan 14 01:14:22 2024 +0900 Rename `git_hub` to `github` GitHub is a single word, as represented by github.com. commit 6d829af807d29bee5ad51406ead53ce543a5a3bb Author: Koichi ITO <[email protected]> Date: Sat Jan 13 16:44:38 2024 +0900 Add style guide link for `Style/SlicingWithRange` Follow up https://github.com/rubocop/ruby-style-guide/pull/939 commit 172937ed1e353de5269deb1669f8896c845c3e15 Author: Koichi ITO <[email protected]> Date: Sat Jan 13 01:14:32 2024 +0900 Add style guide link for `Style/OptionHash` Closes https://github.com/rubocop/rubocop/issues/12401. commit c51dfeca84f68d72130a5b60ed85fc017cc38106 Author: Kobus Post <[email protected]> Date: Thu Nov 30 11:52:52 2023 +0100 Add start of string to regexps in DisabledConfigFormatter commit 4e392b289b88c2aafba9900af1c883cbe4c6d692 Author: Kobus Post <[email protected]> Date: Tue Nov 14 10:56:27 2023 +0100 Include expanded EnforcedStyle options when --no-auto-gen-enforced-style is given commit b36fe4adff4c15354c1a64c57ad9e97a01fcbf48 Author: Koichi ITO <[email protected]> Date: Thu Jan 11 18:09:40 2024 +0900 [Fix #12601] Make `Style/EachForSimpleLoop` accept block with no parameters Fixes #12601. This PR makes `Style/EachForSimpleLoop` accept block with no parameters. This is the behavior according to the documentation: > This check only applies if the block takes no parameters. https://docs.rubocop.org/rubocop/1.59/cops_style.html#styleeachforsimpleloop commit 075d4d5d7597c2b179a90f76a2a9fc886465ecb9 Author: marocchino <[email protected]> Date: Fri Dec 15 11:43:31 2023 +0900 [Fix #12542] Fix false positive for `Lint/MixedRegexpCaptureTypes` commit b9d793a7609c481feb19943b9ddcb4b7e4da277a Merge: 91f7d9acf 64fb437e3 Author: Koichi ITO <[email protected]> Date: Fri Jan 12 11:22:29 2024 +0900 Merge pull request #12610 from gsamokovarov/dont-omit-parentheses-in-argument-blocks Accept parentheses in argument calls with blocks commit 64fb437e3e1f6a38a2c6216a797921417c7394b9 Author: Genadi Samokovarov <[email protected]> Date: Thu Jan 11 12:00:17 2024 +0200 Accept parentheses in argument calls with blocks In `Style/MethodCallWithArgsParentheses` with `omit_parentheses` enforced style we need to allow parentheses in method calls with blocks, when their value is used as an arguments in method dispatch calls. We have syntax errors when we enforce their omissions: ```ruby foo( Class.new(Base) do # valid Ruby end ) ``` Should be allowed as the example below is invalid Ruby: ```ruby foo( Class.new Base do # invalid Ruby end ) ``` commit 91f7d9acf80ce78c9cbd2e6a9fab3c8db08e9e8d Author: Koichi ITO <[email protected]> Date: Thu Dec 28 18:28:45 2023 +0900 [Fix #12571] Fix false posives for `Naming/BlockForwarding` Fixes #12571. This PR fixes false positives for `Naming/BlockForwarding` when using explicit block forwarding in block method. commit 730c4a9f22e76e2c2a4aa6f509406b5fc56e2880 Author: Koichi ITO <[email protected]> Date: Fri Dec 29 00:07:58 2023 +0900 Fix false positives for `Style/ArgumentsForwarding` Fixes https://github.com/rubocop/rubocop/issues/12571#issuecomment-1870575888. This PR fixes false positives for `Style/ArgumentsForwarding` when rest arguments forwarding to a method in block. commit 86822c3a74cd7ed5fdc21f9200366613b3267265 Author: Koichi ITO <[email protected]> Date: Sun Dec 31 16:01:17 2023 +0900 [Fix #11033] Change warning message for `Lint/Syntax` when using LSP Fixes #11033. ## Summary This PR changes warning message for `Lint/Syntax` between LSP and the command line. The redundancy of the offense message probably depends on the context. The context in which the issue has been reported is LSP. In LSP, source code being typed may still be evaluated as invalid syntax. On the other hand, when executed via the `rubocop` command line, the input is usually complete and evaluated as valid syntax in most cases. This means that suggesting a possible misconfiguration in .rubocop.yml would be sufficient only when using the command line. So, this is because the difference in evaluation timing of source code. Therefore, it is implemented as a distinction based on the execution context, rather than as a configuration option. ## Additional Information To resolve this, it seems reasonable to switch the context of the message between LSP and the `rubocop` command line. As for implementation, while the issue in Solargraph won't be directly resolved, considering a switch to RuboCop's built-in LSP could be an option. This PR adds the `RuboCop::Base#lsp_mode?` method, which is intended to be used for the LSP mode expansion I'm currently considering. The LSP still can be carved, and I think there is potential to make RuboCop's LSP more user-friendly and improve it. commit 39484b81005040aed438983ec0e5384ef907ef33 Author: Koichi ITO <[email protected]> Date: Sat Jan 6 01:48:32 2024 +0900 [Fix #12233] Make `Style/SlicingWithRange` aware of beginless range Fixes #12233. This PR makes `Style/SlicingWithRange` aware of redundant and beginless range. Ruby 2.7 introduced beginless ranges. But, unlike the somewhat obscure `-1` in `ary[1..-1]`, the `0` in `ary[0..42]` is clear as a starting point. In fact, changing it to `ary[..42]` could potentially make it less readable. Therefore, `ary[0..42]` should respect the original programmer's intent. On the other hand, `ary[nil..42]` could be replaced with `ary[..42]`. Similarly, `ary[1..nil]` could be replaced with `ary[1..]`. Moreover, `[0..-1]` in `ary[0..-1]` is redundant and simply synonymous with `ary`. This PR has also made adjustments to detect this case. While this is a byproduct of supporting beginless and endless ranges, I think including this change in `Style/SlicingWithRange` cop may be suitable and not feel out of place. commit 975ba2a6cbb88d86cf13127592a7e28974b48a85 Author: Koichi ITO <[email protected]> Date: Sun Jan 7 01:58:02 2024 +0900 [Fix #12437] Fix an infinite loop error for `Style/MethodCallWithArgsParentheses` Fixes #12437. This PR fixes an infinite loop error for `EnforcedStyle: omit_parentheses` of `Style/MethodCallWithArgsParentheses` with `Style/SuperWithArgsParentheses`. In #12390, `super` has become a separate `Style/SuperWithArgsParentheses` cop. This PR prevents the infinite loop error by ensuring that `Style/MethodCallWithArgsParentheses` no longer detects `super`, following the separation of `super` into `Style/SuperWithArgsParentheses` cop. This approach aligns with the perspective that methods and `super` have different considerations regarding parentheses usage, as mentioned in #12390. commit 61f92452f1c529a8810bce336f9f23c9bbc5b19e Author: Koichi ITO <[email protected]> Date: Wed Jan 10 18:17:12 2024 +0900 Fix a false positive for `Style/RedundantParentheses` This PR fixes a false positive for `Style/RedundantParentheses` when regexp literal attempts to match against a parenthesized condition. The presence or absence of parentheses here changes the meaning of the syntax, so the parentheses are not redundant: ```console $ ruby-parse -e '/regexp/ =~ (foo || bar)' (match-with-lvasgn (regexp (str "regexp") (regopt)) (begin (or (send nil :foo) (send nil :bar)))) $ ruby-parse -e '/regexp/ =~ foo || bar' (or (match-with-lvasgn (regexp (str "regexp") (regopt)) (send nil :foo)) (send nil :bar)) ``` commit 5f3112c186246039fafdebbc025cd89da27f6e04 Merge: 5cd23f889 55e9e70bb Author: Koichi ITO <[email protected]> Date: Thu Jan 11 10:26:27 2024 +0900 Merge pull request #12593 from koic/ruby_33 Require Parser 3.3.0.2 or higher commit 5cd23f889d24c4b99305db980dbaddf0134554bb Merge: 753a82c8a 4d058aa8c Author: Koichi ITO <[email protected]> Date: Wed Jan 10 12:16:37 2024 +0900 Merge pull request #12604 from koic/fix_a_false_positive_for_style_multiline_ternary_operator [Fix #12603] Fix an infinite loop error for `Style/MultilineTernaryOperator` commit 4d058aa8c2651bf2d59f554281a8fe9545b39c0d Author: Koichi ITO <[email protected]> Date: Tue Jan 9 19:27:09 2024 +0900 [Fix #12603] Fix an infinite loop error for `Style/MultilineTernaryOperator` Fixes #12603. This PR fixes an infinite loop error for `Style/MultilineTernaryOperator` when using a method call as a ternary operator condition with a line break between receiver and method. commit 753a82c8abee64afb557add55ce3a21f3a3b366a Author: Koichi ITO <[email protected]> Date: Tue Jan 9 12:43:20 2024 +0900 Remove useless FIXME comment There is no context provided in the introduction of #9240. commit 3ce4fbfa8865740d963772d6ecd926cf9c5b0893 Merge: 0f2697d17 8844cefbf Author: Koichi ITO <[email protected]> Date: Mon Jan 8 00:20:13 2024 +0900 Merge pull request #12598 from jonas054/12179_auto_gen_config_with_max [Fix #12179] Generate Exclude when Max is overridden commit 55e9e70bbeea7f1949e01aaf6e858364f70bb94d Author: Koichi ITO <[email protected]> Date: Fri Jan 5 23:43:33 2024 +0900 Require Parser 3.3.0.2 or higher Ruby 3.3 and Parser 3.3.0.2 have been released. - https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released - https://rubygems.org/gems/parser/versions/3.3.0.2 This PR requires Parser 3.3.0.2 or higher and removes "experimental" label from support matrix. The Parser gem specifies version 3.3.0.2+, not 3.3.0.0, as it applies the following patch: https://github.com/whitequark/parser/pull/987 commit 0f2697d176d1d8f666aa08b02e9f1631edccaa53 Author: Koichi ITO <[email protected]> Date: Mon Jan 8 00:03:33 2024 +0900 Revert "Workaround for an error when parsing heredoc with non-word delimiters" Parser gem 3.3.0.2 has been released. So, this reverts commit 5b08ee481cc54f293b9815115511288f7199d80d. commit cdc7f02e1e06c6d7a6af9edc768a2a319af35114 Merge: 7adcf786f 5b08ee481 Author: Koichi ITO <[email protected]> Date: Sun Jan 7 23:36:09 2024 +0900 Merge pull request #12599 from koic/pending_two_specs_for_heredoc_with_non_word_delimiters Workaround for an error when parsing heredoc with non-word delimiters commit 5b08ee481cc54f293b9815115511288f7199d80d Author: Koichi ITO <[email protected]> Date: Sun Jan 7 22:18:07 2024 +0900 Workaround for an error when parsing heredoc with non-word delimiters Pending two specs until the following error in Parser 3.3.0.1 is resolved. https://github.com/whitequark/parser/pull/987 commit 8844cefbf28bcd70e79de24d9460133ac59f5227 Author: Jonas Arvidsson <[email protected]> Date: Sat Jan 6 16:27:29 2024 +0100 [Fix #12179] Generate `Exclude` when `Max` is overridden For a cop that has a Max setting, if that setting is overridden in user configuration, creating a Max property in .rubocop_todo.yml will be useless. User configuration will take precedence and after running `rubocop --auto-gen-config` there can still be offenses that get reported in the next `rubocop` run. With this modification, we avoid the problem by generating `Exclude` instead of `Max` in those situations. commit 7adcf786fb105ebdd390e3640273a5252cddc876 Author: Koichi ITO <[email protected]> Date: Sat Jan 6 16:15:23 2024 +0900 Remove useless code from options_spec The inner `options.parse` causes an exception, so the outer `options.parse` is never called, making it a useless piece of code. commit 88df571fd32c5317c0fdb0caeeacfedf09525978 Author: Akhil G Krishnan <[email protected]> Date: Sun Dec 31 07:55:44 2023 +0530 Bump license years to 2024 commit d3f04df0e1f8395502de11230a318a14fe1bb569 Author: Koichi ITO <[email protected]> Date: Fri Jan 5 01:45:18 2024 +0900 Tweak offense message for `Style/SlicingWithRange` This commit tweaks `Style/SlicingWithRange`'s offense message to reflect actual range value, rather than using a fixed message. commit 910e5774bc65cc572bbf4cefa03c6d40469cdd67 Author: Koichi ITO <[email protected]> Date: Thu Jan 4 22:54:40 2024 +0900 Use RuboCop RSpec 2.26 This PR uses RuboCop RSpec 2.26 and autocorrects the following new `RSpec/ExampleWording` offenses: ```console $ bundle exec rubocop Offenses: spec/project_spec.rb:308:11: C: [Corrected] RSpec/ExampleWording: Do not use the future tense when describing your tests. it 'will not have a directory' do ^^^^^^^^^^^^^^^^^^^^^^^^^ (snip) ``` https://github.com/rubocop/rubocop-rspec/releases/tag/v2.26.0 commit 9dd56ef7981d8d8a1a466217bd2d65787f0374c7 Author: Koichi ITO <[email protected]> Date: Thu Jan 4 02:08:57 2024 +0900 Raise an exception if automation task `system` fails Same as https://github.com/rubocop/rubocop-minitest/commit/8f8f978. commit 623fef0eeab3f774023c22f0ecc6e39c4685307f Author: Koichi ITO <[email protected]> Date: Mon Jan 1 02:05:52 2024 +0900 Tweak the changelog URL on RubyGems.org This PR tweaks changelog URL on RubyGems.org. https://rubygems.org/gems/rubocop The CHANGELOG.md is extensive, so the link of the changelog on RubyGems.org will be updated to point to the GitHub release page, focusing on the release version. e.g., https://github.com/rubocop/rubocop/releases/tag/v1.59.0 The idea is the same as in https://github.com/rubocop/rubocop/pull/8775. commit 5d7f57ee15cd9e4a1513a4834a172242c3a3b606 Author: Koichi ITO <[email protected]> Date: Wed Jan 3 13:06:03 2024 +0900 CircleCI against Ruby 3.3 Ruby 3.3.0 has been released and this Ruby version is available on `cimg/ruby:3.3` image. - https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released/ - https://circleci.com/developer/en/images/image/cimg/ruby commit a6f97574aa391a8e6594598ae34414fb04020a95 Merge: b7de9f008 3325d42a8 Author: Koichi ITO <[email protected]> Date: Tue Jan 2 01:24:30 2024 +0900 Merge pull request #12589 from jonas054/12574_auto_gen_bad_style [Fix #12574] Handle unrecognized style better in --auto-gen-config commit 3325d42a82e6501797f214cd5dea171d3c595729 Author: Jonas Arvidsson <[email protected]> Date: Mon Jan 1 15:17:15 2024 +0100 [Fix #12574] Handle unrecognized style better in --auto-gen-config When there are supported styles in the cop configuration, auto-generated configuration should get an EnforcedStyle entry if the inspected code base conforms, not to the currently select style, but to one of the other styles, and follows that style in all places. If the code base contains code the conforms to different styles, we should get an Exclude entry instead. The same goes for code that doesn't conform to any of the cop's supported styles. This last case is where we had a bug. We didn't mark the style as unrecognized, which is why we got an EnforcedStyle instead of an Exclude. commit b7de9f008cc0779649d04cc57b70624a169e263c Author: Koichi ITO <[email protected]> Date: Mon Jan 1 17:16:17 2024 +0900 Use the latest Ruby 3.3 parser for docs commit 01928d51c25d5a8fb191e1e28a2be44ed4568c17 Author: Koichi ITO <[email protected]> Date: Sat Dec 30 19:56:37 2023 +0900 [Fix #12236] Fix an error for `Lint/ShadowedArgument` Fixes #12236. This PR fixes an error for `Lint/ShadowedArgument` when self assigning to a block argument in `for`. commit 5457ca8ab65008a59d67dcfab5c9b6c3852d5f8c Merge: 1cadf985f 81f513838 Author: Koichi ITO <[email protected]> Date: Sun Dec 31 01:29:16 2023 +0900 Merge pull request #12580 from koic/fix_an_error_for_layout_end_alignment Fix an infinite loop error for `Layout/EndAlignment` commit 1cadf985f8941da328b66cb8ef92c5f922ae4d5f Merge: f848986a3 be6b3e954 Author: Koichi ITO <[email protected]> Date: Sat Dec 30 00:58:41 2023 +0900 Merge pull request #12581 from eugeneius/trailing_line_continuation Handle trailing line continuation in Layout/LineContinuationLeadingSpace commit be6b3e954d544ef806d7b6c41c5701200c7d49d6 Author: Eugene Kenny <[email protected]> Date: Fri Dec 29 13:54:16 2023 +0000 Handle trailing line continuation in Layout/LineContinuationLeadingSpace Previously this would crash with: NoMethodError: undefined method `length' for nil:NilClass commit 81f5138384979c1b61522d4426afeb26f2ad5f76 Author: Koichi ITO <[email protected]> Date: Fri Dec 29 14:39:35 2023 +0900 Fix an infinite loop error for `Layout/EndAlignment` Fixes https://github.com/standardrb/standard/issues/598. This PR fixes an infinite loop error for `Layout/EndAlignment` when misaligned in singleton class assignments with `EnforcedStyleAlignWith: variable`. commit f848986a37f0c033a7a4c736cf04025f97fe6645 Merge: 229f20565 0187af3e2 Author: Koichi ITO <[email protected]> Date: Fri Dec 29 15:15:01 2023 +0900 Merge pull request #12572 from koic/change_emulate_ruby33_warning_for_security_open Follow a Ruby 3.3 warning for `Security/Open ` commit 0187af3e2b66f957810079f662c4afebcb5473b1 Author: Koichi ITO <[email protected]> Date: Tue Dec 26 10:25:29 2023 +0900 Follow a Ruby 3.3 warning for `Security/Open ` This PR follows the following Ruby 3.3 warning for `Security/Open` when `open` with a literal string starting with a pipe: ```console $ ruby -we "open('| ls')" ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin22] -e:1: warning: Calling Kernel#open with a leading '|' is deprecated and will be removed in Ruby 4.0; use IO.popen instead ``` commit 229f20565a9001b9edc79b09c30bd423d05c11ad Merge: 1718e8d13 cbaf216ce Author: Koichi ITO <[email protected]> Date: Thu Dec 28 01:03:04 2023 +0900 Merge pull request #12575 from koic/ci_against_ruby_3_3_on_windows CI against Ruby 3.3 on Windows commit cbaf216ceeabb33cb69207f3333294fffff5b8fe Author: Koichi ITO <[email protected]> Date: Wed Dec 27 22:47:06 2023 +0900 CI against Ruby 3.3 on Windows https://github.com/ruby/setup-ruby/pull/555 has been merged. commit 1718e8d13c30ad9b39aba29f8aee89957111ce1b Author: Koichi ITO <[email protected]> Date: Wed Dec 27 10:20:59 2023 +0900 Remove unused vars in spec of `Layout/SpaceAroundMethodCallOperator` commit 94d14fe67f429ffe89dcce2e39e0a3e03d9d5fbf Merge: 9fb1e252f 9cd81365e Author: Koichi ITO <[email protected]> Date: Tue Dec 26 21:37:07 2023 +0900 Merge pull request #12570 from koic/fix_an_error_for_style_identical_conditional_branches [Fix #12569] Fix an error for `Style/IdenticalConditionalBranches` commit 9cd81365e4ad15eea5b92b19154c64d1b5042d4c Author: Koichi ITO <[email protected]> Date: Mon Dec 25 21:30:28 2023 +0900 [Fix #12569] Fix an error for `Style/IdenticalConditionalBranches` Fixes #12569. This PR fixes an error for `Style/IdenticalConditionalBranches` when using `if`...`else` with identical leading lines that assign to `self.foo`. NOTE: It would be better to update `RuboCop::AST::OpAsgnNode` to handle `self.foo ||= value` to solve the issue in future. commit 9fb1e252f8b0a9e6038fae86dd4e345ef35986d3 Author: Koichi ITO <[email protected]> Date: Mon Dec 25 09:43:56 2023 +0900 Remove redundant blank line from documentation generator commit 34f93a01773b46115ef1e3a46d19b4f1380381a2 Author: Koichi ITO <[email protected]> Date: Mon Dec 25 09:27:32 2023 +0900 Remove unused code in `Style/EvalWithLocation` Follow up https://github.com/rubocop/rubocop/pull/9411. commit e195110c2ab2ba8c3baa58da499a5ff12f8e9238 Author: Sam Bostock <[email protected]> Date: Tue Dec 19 14:36:39 2023 -0600 Document `Style/SymbolProc` protected method incompatibility This documents the false positive for `Style/SymbolProc` when used with a `protected` method. `public` and `private` method behaviour matches, but `protected` methods which work in the normal block style break when using `Symbol#to_proc`. commit 6ed8c7174938983c61d5e0f0ce028bc0110d721c Author: Koichi ITO <[email protected]> Date: Sun Dec 24 01:10:28 2023 +0900 [Fix #12548] Fix an infinite loop error for `Layout/FirstArgumentIndentation` Fixes #12548. This PR fixes an infinite loop error for `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArrayAlignment`. commit 38bcf13324dde68fce326885864771054329183f Merge: 14e26fdae 81ef82ddc Author: Koichi ITO <[email protected]> Date: Sun Dec 24 08:47:10 2023 +0900 Merge pull request #12566 from koic/make_style_redundant_each_aware_of_safe_navigation_operator [Fix #12453] Make `Style/RedundantEach` aware of safe navigation operator commit 14e26fdae1b0d2959fabd67c525467b9217fc405 Author: Koichi ITO <[email protected]> Date: Sat Dec 23 13:54:59 2023 +0900 Remove useless `require pathname` commit 81ef82ddcdca995b839e6a94bd873576e43686e0 Author: Koichi ITO <[email protected]> Date: Sat Dec 23 00:35:24 2023 +0900 [Fix #12453] Make `Style/RedundantEach` aware of safe navigation operator Fixes #12453. This PR makes `Style/RedundantEach` aware of safe navigation operator. And offense range has been tweaked to clarify whether the target for removal, associated with the detection of safe navigation, is `.` or `&.`. commit ff458bf531a558489ef91e094877d7543674258a Author: Arman Singh Grewal <[email protected]> Date: Fri Dec 22 21:04:05 2023 +0530 Add RuboCop icons with white bg (#12554) Useful in dark themes. commit 12fc3222993c204d7dca492ef26a0aabdba3c041 Author: Sam Bostock <[email protected]> Date: Wed Dec 20 08:20:31 2023 -0600 Improve `Style/InvertibleUnlessCondition` message The existing message is ambiguous about how to invert the condition, leading many to assume the cop is suggesting replacing code like unless number.odd? ^^^^^^^^^^^^^^^^^^ Favor `if` with inverted condition over `unless`. with if !number.odd? which would conflict with `Style/NegatedIf`. This updates the message to clearly describe the change being recommended: unless number.odd? ^^^^^^^^^^^^^^^^^^ Prefer `if number.even?` over `unless number.odd?`. commit 685a7f81f3fcfebd77fd4806b4473144c1926da1 Author: Evan Goldenberg <[email protected]> Date: Tue Dec 12 14:42:43 2023 -0800 Allow autocorrect with display-only-fail-level-offenses The `--display-only-fail-level-offenses` option uses `considered_failure?` to determine what to print. The same method is used to determine the exit code of `rubocop`, so the two options should be entirely safe to use together. This change is useful when using rubocop as part of a pre-commit hook. When the hook fails becuase rubocop exited with a non-zero status, we can use `--display-only-fail-level-offenses` to avoid having the output cluttered up with non-blocking offenses. commit 74abd36bb04f30a4c6bce199f4ea53e805cfc101 Merge: 7de40e04e ac5eecb14 Author: Koichi ITO <[email protected]> Date: Fri Dec 22 11:14:39 2023 +0900 Merge pull request #12564 from koic/fix_incorrect_autocorrect_for_style_map_to_hash Fix an incorrect autocorrect for `Style/MapToHash` commit ac5eecb14055926e920db11ec9fae61718031247 Author: Koichi ITO <[email protected]> Date: Thu Dec 21 19:09:28 2023 +0900 Fix an incorrect autocorrect for `Style/MapToHash` Follow https://github.com/rubocop/rubocop/pull/12560#discussion_r1432423841 This PR fixes an incorrect autocorrect for `Style/MapToHash` using safe navigation operator. NOTE: This is a partial unreleased regression of #12560. So, it has not been added to the changelog. commit 7de40e04e0a244efa1dfa3e9d7d904b902601bb6 Merge: 2a72b6c0c 24fae5e65 Author: Koichi ITO <[email protected]> Date: Thu Dec 21 22:09:49 2023 +0900 Merge pull request #12563 from koic/fix_false_positives_for_style_redundant_parentheses [Fix #12556] Fix false positives for `Style/RedundantParentheses` commit 24fae5e6518f8e2883a64cc308b4238dbb75ad43 Author: Koichi ITO <[email protected]> Date: Thu Dec 21 00:40:02 2023 +0900 [Fix #12556] Fix false positives for `Style/RedundantParentheses` Fixes #12556. This PR fixes false positives for `Style/RedundantParentheses` when parentheses are used around a semantic operator in expressions within assignments. commit 2a72b6c0c40e1e538c8c2d7e5dc8fecf19973da2 Author: Koichi ITO <[email protected]> Date: Wed Dec 20 12:57:10 2023 +0900 [Fix #12558] Fix an incorrect autocorrect for `Style/MapToHash` Fixes #12558. This PR fixes an incorrect autocorrect for `Style/MapToHash` when using `map.to_h` without receiver. commit 1b3c31b93f9945dbdfd0ef0ab8bec21eaa52f080 Author: Daniel Vandersluis <[email protected]> Date: Thu Dec 14 14:43:44 2023 -0500 Fix new `Style/ArgumentsForwarding` offenses. commit 626894b26ce1bd8008ac80fe81958869e644ed43 Author: Daniel Vandersluis <[email protected]> Date: Thu Dec 14 14:42:53 2023 -0500 Fix false negative in `Style/ArgumentsForwarding` when a block is forwarded but other args aren't. commit 5af4bad2b420a2c7d4bd2d5385191cadda2f5586 Merge: faf48f15e bb49018c2 Author: Koichi ITO <[email protected]> Date: Tue Dec 19 02:47:10 2023 +0900 Merge pull request #12538 from koic/make_style_each_for_simple_loop_aware_of_safe_navigation_operator [Fix #12478] Make `Style/EachForSimpleLoop` cops aware of safe navigation operator commit faf48f15e1c990c1767fe6d08cd269115d73db5b Merge: 4843acda5 fa660e155 Author: Koichi ITO <[email protected]> Date: Mon Dec 18 08:17:38 2023 +0800 Merge pull request #12550 from koic/fix_a_false_positive_for_style_redundant_line_continuation [Fix #12549] Fix a false positive for `Style/RedundantLineContinuation` commit 4843acda5e1fad8a6b64da1c9f6a3d6dab6e591c Author: Koichi ITO <[email protected]> Date: Sun Dec 17 17:13:43 2023 +0800 Add contribution note to cops documentation generator Occasionally I reviewed direct edit to cops documentation. This is similar in intent to the following: https://github.com/rubocop/rubocop/pull/11563 For source code comments, refer to the AsciiDoc documentation: https://docs.asciidoctor.org/asciidoc/latest/comments/#comment-blocks commit fa660e155e5d550a7b42abe06dbbfb00983aa9e8 Author: Koichi ITO <[email protected]> Date: Sat Dec 16 16:33:52 2023 +0800 [Fix #12549] Fix a false positive for `Style/RedundantLineContinuation` Fixes #12549. This PR fixes a false positive for `Style/RedundantLineContinuation` when line continuations for …
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've found #986 regression in the following RuboCop CI matrix: https://github.com/rubocop/rubocop/actions/runs/7437077900/job/20234293932?pr=12598
So, #986 was not a sufficient fix. This PR fixes an error when using heredoc with non-word delimiters:
The following repro test have been newly added: