-
Notifications
You must be signed in to change notification settings - Fork 247
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
Issue #572: make kernel warn configurable #579
Issue #572: make kernel warn configurable #579
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: RuboCop found unknown Ruby version 3.0 in `TargetRubyVersion` paramete...
Error: RuboCop found unknown Ruby version 3.0 in `TargetRubyVersion` parameter (in .rubocop.yml). Supported versions: 2.4, 2.5, 2.6, 2.7, 2.8
Question: Indirect use of Listen Having access to Listen gem directly allows configuration but what about people using Listen indirectly through guard for example. I'm not super familiar with guard, would people need to be able to silence these or would it be the gem using Listen to make a port for Listen configuration. |
@AlexB52, you asked over in the issue:
Yes, exactly. I've read through a couple of those issues and they were able to be closed without needing this... so I get a little worried that the feature here that would allow them to be silenced might simply mask a more general issue that still wasn't fixed. But I think that's an ok risk to take. |
I'm not super-familiar with But if it's a command-line interface, that interface would need to expose this |
Makes sense, thanks.
This is how I currently silence these warnings in retest by monkey patching the I'll definitely try to migrate over the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: RuboCop found unknown Ruby version 3.0 in `TargetRubyVersion` paramete...
Error: RuboCop found unknown Ruby version 3.0 in `TargetRubyVersion` parameter (in .rubocop.yml). Supported versions: 2.4, 2.5, 2.6, 2.7, 2.8
@AlexB52 For separate processes like Do you think that's sufficient for now? |
The environment variable is a nice addition and the change provides plenty of options for people to silence logger warnings. That said I see a few issues unless I'm misunderstanding something. TL;DR
1. What about
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: RuboCop found unknown Ruby version 3.0 in `TargetRubyVersion` paramete...
Error: RuboCop found unknown Ruby version 3.0 in `TargetRubyVersion` parameter (in .rubocop.yml). Supported versions: 2.4, 2.5, 2.6, 2.7, 2.8
e688838
to
6197c92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some files could not be reviewed due to errors:
Error: RuboCop found unknown Ruby version 3.0 in `TargetRubyVersion` paramete...
Error: RuboCop found unknown Ruby version 3.0 in `TargetRubyVersion` parameter (in .rubocop.yml). Supported versions: 2.4, 2.5, 2.6, 2.7, 2.8
Sounds good. It's a good point that people could have monkey-patched the
Note: I did not try to test whether the warnings were pushed to a log file but only that logs were muted with |
That looks great, @AlexB52. Thanks for the thorough testing. I'm good with merging it now. Sound good? |
@ColinDKelley yup sounds good |
Kernel#warn
configurable throughListen.adapter_warn_behavior =
.Adapter Warnings
If listen is having trouble with the underlying adapter, it will display warnings with
Kernel#warn
by default,which in turn writes to STDERR.
Sometimes this is not desirable, for example in an environment where STDERR is ignored.
For these reasons, the behavior can be configured using
Listen.adapter_warn_behavior =
:Also there are some cases where specific warnings are not helpful.
For example, if you are using the polling adapter--and expect to--you can suppress the warning about it
by providing a callable object like a lambda or proc that determines the behavior based on the
message
: