ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "Eregon (Benoit Daloze)" <noreply@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:109832] [Ruby master Misc#17591] Test frameworks and REPLs do not show deprecation warnings by default
Date: Sat, 03 Sep 2022 13:57:06 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-99070.20220903135706.772@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17591.20210129125733.772@ruby-lang.org

Issue #17591 has been updated by Eregon (Benoit Daloze).

Status changed from Open to Closed

This is done, except for RSpec, which is tracked in https://github.com/rspec/rspec-core/issues/2867.

----------------------------------------
Misc #17591: Test frameworks and REPLs do not show deprecation warnings by default
https://bugs.ruby-lang.org/issues/17591#change-99070

* Author: Eregon (Benoit Daloze)
* Status: Closed
* Priority: Normal
----------------------------------------
Various people in #16345 said that:
> The issue can be mitigated if all test frameworks enable all deprecation warnings.
> The developer's practice can be supported by tools, such as test frameworks enable deprecation warnings automatically.

And this was used as a base to disable deprecation warnings by default in Ruby 2.7.2.

However, it seems no test frameworks or REPLs actually show deprecation warnings by default!
So Ruby developers will typically never see deprecation warnings for keyword arguments, and it will just break when they try Ruby 3.0.

I think only MSpec does `Warning[:deprecated] = true`, whether or not `-w` is passed, which seems the right thing to do.

Currently, RSpec enables `Warning[:deprecated] = true` only for `rspec -w`.

Same for `test/unit` 3.3.4 shipped with 2.7.2.

IRB in 2.7.2 does not show deprecated warnings.
Same for `pry`.

I think ruby-core needs to have a clear message here, like:
> All test frameworks and REPLs should include this snippet and run it before running tests: `Warning[:deprecated] = true if Warning.respond_to?(:[]=)`.
> This is important so that developers see warnings in development, and that they see the warnings before updating to the next Ruby version.
> Developers can choose to disable deprecation warnings explicitly if they want with `Warning[:deprecated] = false`.

And I think it would be good that ruby-core makes a PR or an issue to the main test frameworks/REPLs to show examples.

P.S.: if someone wants to disable all warnings with `-W0` or `$VERBOSE = nil`, it will indeed disable them all, including deprecation warnings, so there is no need to check `$VERBOSE` for setting `Warning[:deprecated] = true`.



-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2022-09-03 13:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 12:57 [ruby-core:102301] [Ruby master Bug#17591] Test frameworks and REPLs do not show deprecation warnings by default eregontp
2021-01-29 13:01 ` [ruby-core:102303] " eregontp
2021-01-29 21:59 ` [ruby-core:102312] " kou
2021-02-16  6:56 ` [ruby-core:102521] [Ruby master Misc#17591] " aycabta
2021-02-16 12:19 ` [ruby-core:102534] " eregontp
2021-02-16 12:26 ` [ruby-core:102535] " eregontp
2021-02-16 12:31 ` [ruby-core:102536] " eregontp
2021-02-17  8:06 ` [ruby-core:102552] " kou
2021-02-17  8:47 ` [ruby-core:102554] " nagachika00
2021-02-17  8:56 ` [ruby-core:102556] " nobu
2021-02-17  9:06 ` [ruby-core:102557] " kou
2022-09-03 13:57 ` Eregon (Benoit Daloze) [this message]
2023-05-27  9:55 ` [ruby-core:113679] " byroot (Jean Boussier) via ruby-core
2023-05-27 10:12 ` [ruby-core:113682] " Eregon (Benoit Daloze) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-99070.20220903135706.772@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).