metanorma / metanorma-cli

CLI (Command Line Interface) for Metanorma
BSD 2-Clause "Simplified" License
5 stars 5 forks source link

Running `metanorma` on Ruby 3.0 outputs multiple URI-related warnings #259

Closed ronaldtse closed 3 years ago

ronaldtse commented 3 years ago

These come from some require "open-uri" or require "uri" call in the stack that is not needed in Ruby 3.0.

We need to find that offending line and remove it. Both open-uri and uri are Ruby default gems and are required by default, they do not need to be manually required.

/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/version.rb:3: warning: already initialized constant URI::VERSION_CODE
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/version.rb:3: warning: previous definition of VERSION_CODE was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/version.rb:4: warning: already initialized constant URI::VERSION
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/version.rb:4: warning: previous definition of VERSION was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc2396_parser.rb:28: warning: already initialized constant URI::RFC2396_REGEXP::PATTERN::ALPHA
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc2396_parser.rb:28: warning: previous definition of ALPHA was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc2396_parser.rb:30: warning: already initialized constant URI::RFC2396_REGEXP::PATTERN::ALNUM
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc2396_parser.rb:30: warning: previous definition of ALNUM was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc2396_parser.rb:34: warning: already initialized constant URI::RFC2396_REGEXP::PATTERN::HEX
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc2396_parser.rb:34: warning: previous definition of HEX was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc2396_parser.rb:36: warning: already initialized constant URI::RFC2396_REGEXP::PATTERN::ESCAPED
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc2396_parser.rb:36: warning: previous definition of ESCAPED was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc2396_parser.rb:40: warning: already initialized constant URI::RFC2396_REGEXP::PATTERN::UNRESERVED
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc2396_parser.rb:40: warning: previous definition of UNRESERVED was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc2396_parser.rb:45: warning: already initialized constant URI::RFC2396_REGEXP::PATTERN::RESERVED
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc2396_parser.rb:45: warning: previous definition of RESERVED was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc2396_parser.rb:48: warning: already initialized constant URI::RFC2396_REGEXP::PATTERN::DOMLABEL
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc2396_parser.rb:48: warning: previous definition of DOMLABEL was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc2396_parser.rb:50: warning: already initialized constant URI::RFC2396_REGEXP::PATTERN::TOPLABEL
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc2396_parser.rb:50: warning: previous definition of TOPLABEL was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc2396_parser.rb:52: warning: already initialized constant URI::RFC2396_REGEXP::PATTERN::HOSTNAME
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc2396_parser.rb:52: warning: previous definition of HOSTNAME was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc3986_parser.rb:6: warning: already initialized constant URI::RFC3986_Parser::RFC3986_URI
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc3986_parser.rb:6: warning: previous definition of RFC3986_URI was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/rfc3986_parser.rb:7: warning: already initialized constant URI::RFC3986_Parser::RFC3986_relative_ref
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/rfc3986_parser.rb:7: warning: previous definition of RFC3986_relative_ref was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:16: warning: already initialized constant URI::REGEXP
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:16: warning: previous definition of REGEXP was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:17: warning: already initialized constant URI::Parser
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:17: warning: previous definition of Parser was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:18: warning: already initialized constant URI::RFC3986_PARSER
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:18: warning: previous definition of RFC3986_PARSER was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:21: warning: already initialized constant URI::DEFAULT_PARSER
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:22: warning: previous definition of DEFAULT_PARSER was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::ABS_URI
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of ABS_URI was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::REL_URI
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of REL_URI was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::URI_REF
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of URI_REF was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::ABS_URI_REF
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of ABS_URI_REF was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::REL_URI_REF
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of REL_URI_REF was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::ESCAPED
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of ESCAPED was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::UNSAFE
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of UNSAFE was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::SCHEME
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of SCHEME was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::USERINFO
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of USERINFO was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::HOST
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of HOST was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::PORT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of PORT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::OPAQUE
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of OPAQUE was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::REGISTRY
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of REGISTRY was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::ABS_PATH
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of ABS_PATH was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::REL_PATH
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of REL_PATH was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::QUERY
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of QUERY was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:28: warning: already initialized constant URI::FRAGMENT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:29: warning: previous definition of FRAGMENT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:277: warning: already initialized constant URI::TBLENCWWWCOMP_
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:294: warning: previous definition of TBLENCWWWCOMP_ was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:283: warning: already initialized constant URI::TBLDECWWWCOMP_
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:300: warning: previous definition of TBLDECWWWCOMP_ was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/common.rb:449: warning: already initialized constant URI::WEB_ENCODINGS_
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/common.rb:466: warning: previous definition of WEB_ENCODINGS_ was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/generic.rb:27: warning: already initialized constant URI::Generic::DEFAULT_PORT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/generic.rb:27: warning: previous definition of DEFAULT_PORT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/generic.rb:46: warning: already initialized constant URI::Generic::COMPONENT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/generic.rb:46: warning: previous definition of COMPONENT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/generic.rb:61: warning: already initialized constant URI::Generic::USE_REGISTRY
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/generic.rb:61: warning: previous definition of USE_REGISTRY was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/file.rb:12: warning: already initialized constant URI::File::DEFAULT_PORT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/file.rb:12: warning: previous definition of DEFAULT_PORT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/file.rb:17: warning: already initialized constant URI::File::COMPONENT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/file.rb:17: warning: previous definition of COMPONENT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ftp.rb:24: warning: already initialized constant URI::FTP::DEFAULT_PORT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ftp.rb:24: warning: previous definition of DEFAULT_PORT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ftp.rb:29: warning: already initialized constant URI::FTP::COMPONENT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ftp.rb:29: warning: previous definition of COMPONENT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ftp.rb:42: warning: already initialized constant URI::FTP::TYPECODE
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ftp.rb:42: warning: previous definition of TYPECODE was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ftp.rb:45: warning: already initialized constant URI::FTP::TYPECODE_PREFIX
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ftp.rb:45: warning: previous definition of TYPECODE_PREFIX was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/http.rb:24: warning: already initialized constant URI::HTTP::DEFAULT_PORT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/http.rb:24: warning: previous definition of DEFAULT_PORT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/http.rb:27: warning: already initialized constant URI::HTTP::COMPONENT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/http.rb:27: warning: previous definition of COMPONENT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/https.rb:19: warning: already initialized constant URI::HTTPS::DEFAULT_PORT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/https.rb:19: warning: previous definition of DEFAULT_PORT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ldap.rb:26: warning: already initialized constant URI::LDAP::DEFAULT_PORT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ldap.rb:26: warning: previous definition of DEFAULT_PORT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ldap.rb:29: warning: already initialized constant URI::LDAP::COMPONENT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ldap.rb:29: warning: previous definition of COMPONENT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ldap.rb:47: warning: already initialized constant URI::LDAP::SCOPE_ONE
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ldap.rb:47: warning: previous definition of SCOPE_ONE was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ldap.rb:48: warning: already initialized constant URI::LDAP::SCOPE_SUB
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ldap.rb:48: warning: previous definition of SCOPE_SUB was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ldap.rb:49: warning: already initialized constant URI::LDAP::SCOPE_BASE
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ldap.rb:49: warning: previous definition of SCOPE_BASE was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ldap.rb:46: warning: already initialized constant URI::LDAP::SCOPE
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ldap.rb:46: warning: previous definition of SCOPE was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/ldaps.rb:18: warning: already initialized constant URI::LDAPS::DEFAULT_PORT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/ldaps.rb:18: warning: previous definition of DEFAULT_PORT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/mailto.rb:21: warning: already initialized constant URI::MailTo::DEFAULT_PORT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/mailto.rb:21: warning: previous definition of DEFAULT_PORT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/mailto.rb:24: warning: already initialized constant URI::MailTo::COMPONENT
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/mailto.rb:24: warning: previous definition of COMPONENT was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/mailto.rb:52: warning: already initialized constant URI::MailTo::HEADER_REGEXP
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/mailto.rb:52: warning: previous definition of HEADER_REGEXP was here
/Users/me/.rbenv/versions/3.0.2/lib/ruby/3.0.0/uri/mailto.rb:55: warning: already initialized constant URI::MailTo::EMAIL_REGEXP
/Users/me/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/uri-0.11.0/lib/uri/mailto.rb:55: warning: previous definition of EMAIL_REGEXP was here
opoudjis commented 3 years ago

The problem is of course that they are required outside of Ruby 3.0, so I will need to make the includes conditional.

opoudjis commented 3 years ago

Has already been addressed: the dependency on open-uri is obsolete, and has been removed from metanorma-ietf in https://github.com/metanorma/metanorma-ietf/commit/3d6fe5f442b1bfaf59407096cac482cde15d1773