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
refactor: refactor CLI part of excel2xml (DEV-2190) #384
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.
Looks good!
One small stylistic thin: I like to be able to "read code from top to bottom" meaning that the public method should be art the beginning, and the private methods after that, ideally in the order they are used in the public method. I definitely wouldn't make this a "hard rule", and there are many edge cases where this cannot be done reasonably anyways. But as a general rule of thumb, how do you feel about this?
Additionally, it came to my mind that the changes you introduced here, should have a big impact on unit testing: Before you could only do an "end to end" test of the huge function; now you have separate units that allow testing much more fine grained and systematically (including all happy and unhappy paths). I don't think this has to be in scope for the current task at hand, but it's definitely something worth considering.
True if everything went well, False otherwise | ||
""" | ||
# read and prepare the input file | ||
success = True |
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.
why is this needed? it's not actually modified
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.
it's modified on (new) line 2244
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... github stopped displaying me the file at line 2243 :)
In that case I would suggest moving it down there, or even change the logic to something like this (pseudo code):
if len(warnings) > 0:
print("Finished with warnings")
return False
print("finished...")
return True
or if you want to keep the flow you currently have
with warnings ... as w:
write(file)
success: bool = len(w) == 0
print(finished...)
return success
resolves DEV-2190