Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Werror mode? - Turn warnings into errors #990

Closed
casperisfine opened this issue Mar 15, 2024 · 4 comments
Closed

-Werror mode? - Turn warnings into errors #990

casperisfine opened this issue Mar 15, 2024 · 4 comments
Assignees

Comments

@casperisfine
Copy link

A pattern I'm using more and more in the projects I maintain is to turn warnings into errors in the test suite: https://github.com/redis-rb/redis-client/blob/84f1c6567eb02a941e94e8ca41f97d55a026ec4c/test/support/raise_warnings.rb

$VERBOSE = true
module RaiseWarnings
  def warn(message, *)
    super
    raise message
  end
  ruby2_keywords :warn if respond_to?(:ruby2_keywords, true)
end
Warning.singleton_class.prepend(RaiseWarnings)

I wish this would just be a minitest feature I could enable with an environment variable or something like that.

Would it be something you'd be open to?

Right now I'm working on https://bugs.ruby-lang.org/issues/20205 which will emit a bunch more warning and such feature would make it much easier for me to ensure all of ruby stdlib is warning free.

@zenspider
Copy link
Collaborator

Man... when I got the mail I read -Warrior mode and got really excited! Alas... but maybe we could call it minitest/warrior.rb ??? 🤪

@zenspider zenspider self-assigned this Mar 15, 2024
casperisfine pushed a commit to Shopify/minitest that referenced this issue Apr 11, 2024
Fix: minitest#990

When working on gems that support multiple Ruby versions,
it can be tricky to noticed you introduced a warning as you
generally develop locally with one specific version and rely
on CI to ensure it still works on other Ruby versions.
casperisfine pushed a commit to Shopify/minitest that referenced this issue Apr 11, 2024
Fix: minitest#990

When working on gems that support multiple Ruby versions,
it can be tricky to noticed you introduced a warning as you
generally develop locally with one specific version and rely
on CI to ensure it still works on other Ruby versions.
@ParadoxV5
Copy link

@casperisfine
Copy link
Author

Thanks for finishing this, and sorry for dropping the ball, I really didn't get much time to work on it lately 😞

@zenspider
Copy link
Collaborator

Absolutely no worries! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants