https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112020-03-19T21:18:35ZRuby Issue Tracking SystemRuby master - Feature #16699: Silence/ignore particular warnings from some parts of the code (in a .rb file)https://bugs.ruby-lang.org/issues/16699?journal_id=847122020-03-19T21:18:35Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul><p><code>Warning.warn</code> added in ruby 2.4 offers the core infrastructure that allows this. The warning gem (<a href="https://rubygems.org/gems/warning" class="external">https://rubygems.org/gems/warning</a>) offers a nice API to support the filtering of such warnings, assuming they are correctly prefixed by the filename in which the warning occurs. <code>rb_warn</code> and <code>rb_warning</code> in the C-API both use that format, as does <code>Kernel#warn</code> with the <code>:uplevel</code> option. Do you see a need for an additional feature in this area, and if so, what do you think the API should look like?</p> Ruby master - Feature #16699: Silence/ignore particular warnings from some parts of the code (in a .rb file)https://bugs.ruby-lang.org/issues/16699?journal_id=847162020-03-20T09:56:34Zsawa (Tsuyoshi Sawada)
<ul><li><strong>Subject</strong> changed from <i>Consider providing ruby developers with a way to specifically silence/ignore particular warnings from some parts of the code (in a .rb file)</i> to <i>Silence/ignore particular warnings from some parts of the code (in a .rb file)</i></li><li><strong>Description</strong> updated (<a title="View differences" href="/journals/84716/diff?detail_id=56650">diff</a>)</li></ul> Ruby master - Feature #16699: Silence/ignore particular warnings from some parts of the code (in a .rb file)https://bugs.ruby-lang.org/issues/16699?journal_id=847202020-03-20T21:24:23ZEregon (Benoit Daloze)
<ul></ul><p>It's also worth noting that changing $VERBOSE is not thread-safe (it's a truly global variable) and might suppress more or less warnings than intended.</p>