[ruby-core:116655] [Ruby master Bug#20252] Incompatibility with the `-h` option in optparse on Ruby 3.4.0dev

Issue #20252 has been reported by koic (Koichi ITO). ---------------------------------------- Bug #20252: Incompatibility with the `-h` option in optparse on Ruby 3.4.0dev https://bugs.ruby-lang.org/issues/20252 * Author: koic (Koichi ITO) * Status: Open * Priority: Normal * ruby -v: ruby 3.4.0dev (2024-02-09T12:28:26Z master 08b77dd682) [x86_64-darwin23] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- An incompatibility has arisen when using optparse with Ruby 3.4.0dev. Below are the steps to reproduce: ```ruby # example.rb require 'optparse' OptionParser.new do |opts| opts.on('--[no-]foo') end.parse! ``` ## Expected (Ruby 3.3 or lower) It is represented as `--[no-]foo`. ```console $ ruby -v ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin22] $ ruby example.rb -h Usage: example [options] --[no-]foo ``` ## Actual (Ruby 3.4) It is represented as `--foo, --no-foo`. ```console $ ruby -v ruby 3.4.0dev (2024-02-09T12:28:26Z master 08b77dd682) [x86_64-darwin23] $ ruby example.rb -h Usage: example [options] --foo, --no-foo ``` This change is likely due to https://github.com/ruby/optparse/pull/60. I have a question. Is the alteration in the representation of the `-h` option from Ruby 3.4.0dev intentional, or should the representation as it was up to Ruby 3.3 be maintained? This incompatibility was encountered during RuboCop's CI. https://github.com/rubocop/rubocop/actions/runs/7845618444/job/21410458812?p... -- https://bugs.ruby-lang.org/
participants (1)
-
koic (Koichi ITO)