1.0.1 warnings - recommended code uses inconsistent capitalized constants
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu với các định nghĩa cảnh báo trong lib/uri/common.rb và lib/uri/rfc3986_parser.rb, sử dụng kết quả git grep của issue để xem xét từng khuyến nghị. Kiểm tra cách các hằng số hiện có được định nghĩa và xác định các dạng viết hoa nhất quán cần được expose. Hoàn tất khi các cảnh báo khuyến nghị các hằng số có cách viết hoa nhất quán mà không nhầm lẫn tên parser và parser-class.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
@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!
- Ngôn ngữ chính
- Ruby
- Star
- 125
- Fork
- 65
- Merge trung bình
- 6 giờ 4 phút
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ruby/uri
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
-
upstream contact for Debian Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
simp/pupmod-simp-simp#395 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
simp/pupmod-simp-rsyslog#219 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
simp/pupmod-simp-pupmod#256 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
simp/pupmod-simp-sudo#150 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100