Skip to content

extract logic from inside Commit class - #6100

Merged
niik merged 5 commits into
masterfrom
extract-logic-from-commit-class
Nov 15, 2018
Merged

niik merged 5 commits into
masterfrom
extract-logic-from-commit-class

Conversation

@shiftkey

@shiftkey shiftkey commented Nov 5, 2018 •

Copy link
Copy Markdown
Member

Overview

While investigating #6085 I needed to create a tree of objects as part of a test Tip -> Branch -> Commit, and I had to stub a function named isWebFlowCommitter to match the instance function already defined on Commit.

This felt wrong for a few reasons:

  • isWebFlowCommiter doesn't update any state on Commit
  • isWebFlowCommitter only needs to read public fields on Commit
  • I found a previous test that encountered this exact issue, and stubbed it with a () => false which just adds noise

This feels to me like a great situation where it can just be a function!

Description

This PR moves isWebFlowCommitter out to app/src/lib/commit-identity.ts and updates the usage to call that function.

  • rename file as commit identity is a different concept

Release notes

Notes: no-notes

@shiftkey shiftkey added tech-debt Issues and pull requests related to addressing technical debt or improving the codebase ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Nov 5, 2018
@shiftkey shiftkey added this to the 1.5.1 milestone Nov 6, 2018
@shiftkey
shiftkey requested review from a team November 9, 2018 21:22
@shiftkey shiftkey added the time-sensitive Pull Requests where reviews need to happen in a timely manner label Nov 13, 2018
@shiftkey

shiftkey commented Nov 13, 2018 •

Copy link
Copy Markdown
Member Author

Marking this as time-sensitive because the bugfix in #6104 depends on it currently and I'd like to ensure that gets into 1.5.1

say25
say25 previously approved these changes Nov 13, 2018

@say25 say25 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😎

@outofambit
outofambit self-requested a review November 13, 2018 21:41

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 👍 on moving the isWebFlowCommitter out of the class itself but commit-identity is already an established concept within the app. Could we find another place for the function to live? Perhaps as another static method on the already existing CommitIdentity class, perhaps we just rename the file to is-web-flow-committer.ts or we let it live in the same file as the commit model like extractCoAuthors except we export it.

@shiftkey

Copy link
Copy Markdown
Member Author

Could we find another place for the function to live?

@niik 👍 I'll rename the file to avoid clashing with commit identity

@shiftkey

Copy link
Copy Markdown
Member Author

🍎

@niik niik self-assigned this Nov 14, 2018
@niik
niik merged commit 8e68089 into master Nov 15, 2018
@niik
niik deleted the extract-logic-from-commit-class branch November 15, 2018 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers tech-debt Issues and pull requests related to addressing technical debt or improving the codebase time-sensitive Pull Requests where reviews need to happen in a timely manner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants