-
Notifications
You must be signed in to change notification settings - Fork 847
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
Allow exception visibility in CLI #2735
Conversation
Signed-off-by: Ulincsys <ulincsys@gmail.com>
@@ -7,6 +7,8 @@ | |||
import click | |||
import importlib | |||
import traceback | |||
|
|||
from pathlib import Path | |||
# import augur.application | |||
|
|||
CONTEXT_SETTINGS = dict(auto_envvar_prefix='AUGUR') |
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.
[pylint] reported by reviewdog 🐶
R1735: Consider using '{"auto_envvar_prefix": 'AUGUR'}' instead of a call to 'dict'. (use-dict-literal)
@@ -24,11 +26,16 @@ def list_commands(self, ctx): | |||
return rv | |||
|
|||
def get_command(self, ctx, name): |
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.
[pylint] reported by reviewdog 🐶
W0237: Parameter 'cmd_name' has been renamed to 'name' in overriding 'AugurMultiCommand.get_command' method (arguments-renamed)
@@ -24,11 +26,16 @@ def list_commands(self, ctx): | |||
return rv | |||
|
|||
def get_command(self, ctx, name): |
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.
[pylint] reported by reviewdog 🐶
R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
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.
LGTM this is needed
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.
Thank you!
The base branch was changed.
Description
This change makes the CLI pass-through all exceptions when they occur while loading a module.
Previously, import exceptions were silenced during import of a CLI command module. Although most exceptions would have been displayed, by catching
ModuleNotFoundError
, any import errors in sub-modules would be silenced during Click imports.The fix is to check first if the module exists using a file check, and if it does not, return None to indicate as such.
Signed commits