Skip to content

Instantly share code, notes, and snippets.

@JayBazuzi
Created September 22, 2018 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayBazuzi/e9e90dac0387cdd55e8083b162f6f569 to your computer and use it in GitHub Desktop.
Save JayBazuzi/e9e90dac0387cdd55e8083b162f6f569 to your computer and use it in GitHub Desktop.
One way to factor a script for a multi-step process.
def main():
return (MergeDownProcess(_WORKSPACE_DIR)
.get_user_intent()
.ensure_on_sparse_branch()
.ensure_no_files_opened()
.ensure_something_to_integrate()
.merge()
.create_changelist_for_any_changes()
.ensure_resolved()
.submit_any_changes()
.report_results())
@JayBazuzi
Copy link
Author

Good: I can read it

Bad: the interdependencies between steps are difficult to see / difficult to verify

Bad: three steps are actually a conditional branch ("if any changes")

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