Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

1.0.1 warnings - recommended code uses inconsistent capitalized constants

オープン
#128 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
ruby
領域
backend

調査の方向性

lib/uri/common.rb と lib/uri/rfc3986_parser.rb の警告定義から始め、issue の git grep の結果を使って各推奨事項を確認します。既存の定数がどのように定義されているかを確認し、公開する一貫した大文字表記の形式を決定します。警告が一貫した大文字表記の定数を推奨し、parser と parser-class の名前を混同しなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

@hsbt First of all, thank you again for your work on ruby.

Following up on #125. The "suggested" or recommended code in the warnings can be confusing:

% ruby -W2 -e "puts RUBY_VERSION; require 'uri'; puts URI::VERSION; puts URI::PATTERN; URI::DEFAULT_PARSER.escape(''); URI::DEFAULT_PARSER.unescape(''); puts URI::Regexp; puts URI::REGEXP"
3.1.6
1.0.1
-e:1: warning: URI::PATTERN is obsolete. Use RFC2396_Parser::PATTERN explicitly.
URI::RFC2396_REGEXP::PATTERN
-e:1: warning: URI::RFC3986_PARSER.escape is obsoleted. Use URI::RFC2396_PARSER.escape explicitly.
-e:1: warning: URI::RFC3986_PARSER.unescape is obsoleted. Use URI::RFC2396_PARSER.unescape explicitly.
-e:1: warning: URI::Regexp is obsolete. Use RFC2396_Parser::Regexp explicitly.
Regexp
-e:1: warning: URI::REGEXP is obsolete. Use URI::RFC2396_REGEXP explicitly.
URI::RFC2396_REGEXP

The problem is this:
RFC2396_Parser vs. RFC2396_PARSER or RFC2396_Parser::Regexp vs. URI::RFC2396_REGEXP

It's easy to make a mistake and use the wrong case. They're very similar names with different capitalization but they're not the same thing. I'm sure there are others:

% git grep "explicitly" lib/uri*
lib/uri/common.rb:      warn "URI::REGEXP is obsolete. Use URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
lib/uri/common.rb:      warn "URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
lib/uri/common.rb:      warn "URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
lib/uri/rfc3986_parser.rb:      warn "URI::RFC3986_PARSER.extract is obsoleted. Use URI::RFC2396_PARSER.extract explicitly.", uplevel: 1 if $VERBOSE
lib/uri/rfc3986_parser.rb:      warn "URI::RFC3986_PARSER.make_regexp is obsoleted. Use URI::RFC2396_PARSER.make_regexp explicitly.", uplevel: 1 if $VERBOSE
lib/uri/rfc3986_parser.rb:      warn "URI::RFC3986_PARSER.escape is obsoleted. Use URI::RFC2396_PARSER.escape explicitly.", uplevel: 1 if $VERBOSE
lib/uri/rfc3986_parser.rb:      warn "URI::RFC3986_PARSER.unescape is obsoleted. Use URI::RFC2396_PARSER.unescape explicitly.", uplevel: 1 if $VERBOSE

Can we add capitalized versions of constants so we can consistently suggest capitalized versions of constants in these warnings?

Thank you!

主要言語
Ruby
スター
125
フォーク
65
平均マージ
6時間 4分
マージ済み PR(30日)
2

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ruby/uri のほかの issue

ruby/uri の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。