Actions
Bug #20252
closedIncompatibility with the `-h` option in optparse on Ruby 3.4.0dev
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-02-09T12:28:26Z master 08b77dd682) [x86_64-darwin23]
Description
An incompatibility has arisen when using optparse with Ruby 3.4.0dev. Below are the steps to reproduce:
# 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
.
$ 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
.
$ 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?pr=12657
Updated by nobu (Nobuyoshi Nakada) 9 months ago
- Status changed from Open to Closed
- Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED
Actions
Like0
Like0