-
Notifications
You must be signed in to change notification settings - Fork 10
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
Move MetaWarning classes into new cli module #142
base: main
Are you sure you want to change the base?
Conversation
Moving them out of __main__.py will make it easier to re-use them across different command-line interfaces, and may make them easier to test. While moving them, I also added the missing docstrings. Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
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.
Not sure if it's just me, but the naming of this module doesn't seem to really fit its contents?
It's called cli.py
but it contains logging stuff, and if we're moving things around, would it make sense to name it something that maps better? (log_utils.py
?)
Otherwise, refactors and new tests look good to me
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.
Ah, I can see the confusion. I'll explain my logic, and you can tell me if it makes sense 😆.
The thinking behind this "cli" module was that it would contain things that were only useful for the user-facing command-line interface, but which might be shared across commands (e.g., the Formatter
is currently used by both codebasin
and cbicov
).
I was basically looking for a way to separate things that we use to build the user-facing CLI from the modules and interfaces that we (eventually) want people to be able to use when importing the codebasin
package into another script.
Maybe it would be better to have this as something like a cli
package, containing a logging.py
? Or an _internal
package containing a logging.py
? I'm definitely open to suggestions here.
Related issues
Part of #36, #96.
The CLI is the least well-tested part of Code Base Investigator, because its legacy implementation lived outside of the
codebasin/
package and was therefore difficult to test. Refactoring common CLI functionality into a dedicated module, using functions with well-defined interfaces, will make this functionality more reliable.Proposed changes
Formatter
,MetaWarning
andWarningAggregator
into a newcli
module.Formatter
,MetaWarning
andWarningAggregator
.