Project

General

Profile

Actions

Bug #18345

closed

Duplicate range in character class warning

Added by halilsen (Halil Sen) over 2 years ago. Updated over 2 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:106132]

Description

#!/usr/bin/env ruby -w
puts RUBY_VERSION
puts "".match?(/[\p{Alnum}|\-|\_]/).inspect
puts '--------------'
trial.rb:3: warning: character class has duplicated range: /[\p{Alnum}|\-|\_]/
2.5.5
false
--------------
trial.rb:3: warning: character class has duplicated range: /[\-|\p{Alnum}|\_]/
2.7.4
false
--------------

If I remove any part of the character class definition [], there is no warning but
I don't think there's a duplicate range here, so there should not be a warning.

Updated by xtkoba (Tee KOBAYASHI) over 2 years ago

| seems to appear twice.

Updated by halilsen (Halil Sen) over 2 years ago

xtkoba (Tee KOBAYASHI) wrote in #note-1:

| seems to appear twice.

Effectively, I didn't see the |s, I must have parse them as logical or. This issue can be closed.

I will open a PR on the grape-swagger side. Cheers xtkoba!

https://github.com/ruby-grape/grape-swagger/blob/4ea61c4c2c0bd88043ebc15041b0eb3967b341ff/lib/grape-swagger.rb#L35

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0