Skip to content

Refactor pr/issue creation code - #2386

Merged
vilmibm merged 7 commits into
trunkfrom
create-refactor
Nov 13, 2020
Merged

vilmibm merged 7 commits into
trunkfrom
create-refactor

Conversation

@vilmibm

@vilmibm vilmibm commented Nov 10, 2020 •

Copy link
Copy Markdown
Contributor

In working on #2313 it struck me that the pr create command has become unmaintainable:

  • over 700 lines of code spread across 3-4 massive functions
  • full of mutually exclusive state: interactive vs. autofill, webmode vs. not
  • spaghetti'd: there is a tremendous amount of state required for it to work and it's not possible
    for a human to keep it in their head

This PR has these goals:

  • PR creation code is comprehensible by the human brain
  • No massive spaghetti functions anymore
  • Composable functions usable by other commands and by issue creation code

The only "functional" change I ended up with is not computing defaults in cases where we are definitely not going to use them (ie when both title and body have already been provided via CLI args).

@vilmibm
vilmibm requested a review from samcoe November 11, 2020 01:24

@samcoe samcoe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is great! Sooo much easier to parse and reason about. I left a a handful of comments/questions, nothing truly blocking though.

Comment thread pkg/cmd/pr/shared/survey.go Resolved
Comment thread pkg/cmd/pr/create/create.go Resolved
Comment thread pkg/cmd/pr/create/create.go Resolved
Comment thread pkg/cmd/pr/create/create.go Resolved
Comment thread pkg/cmd/pr/create/create.go Resolved
Comment thread pkg/cmd/pr/shared/survey.go Resolved
@vilmibm
vilmibm requested a review from mislav November 12, 2020 19:58
@vilmibm
vilmibm marked this pull request as ready for review November 12, 2020 19:58
@vilmibm vilmibm changed the title WIP: refactor pr create Refactor pr/issue creation code Nov 12, 2020
@vilmibm
vilmibm merged commit 9a20719 into trunk Nov 13, 2020

@mislav mislav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for doing the hard work 🙇

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants