Skip to content

Conversation

@sampart
Copy link
Contributor

@sampart sampart commented Nov 23, 2020

I've been thinking about how to slim down our long parameter lists, and noticed that we almost always pass githubAuth and githubUrl as a pair. This PR introduces an interface for a data object which holds those two, so we can slim down parameter lists and introduce a little more type safety.

This change may not be worth the overhead it introduces, but I think it probably is.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.

@sampart sampart force-pushed the api-param-object branch 2 times, most recently from 91bd314 to ecaefc3 Compare November 23, 2020 14:37
Previously, most tests were using https://github.com and only the first was using https://github.example.com. As it happens, https://github.com works for all of them.
Copy link
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

All changes look correct to me. Variables are going to the right places and there's no spurious changes.

I think this change is an improvement overall. It's not an improvement in terms of linecount but it makes each method definition and call-site more clear, and especially when methods delegate to each other and just pass the parameters on. It also removes a very real possibility of getting the auth/url parameters the wrong way around when calling a method.

@sampart sampart marked this pull request as ready for review November 24, 2020 11:50
@sampart sampart merged commit 27520b9 into main Nov 24, 2020
@sampart sampart deleted the api-param-object branch November 24, 2020 12:10
@github-actions github-actions bot mentioned this pull request Nov 30, 2020
@github-actions github-actions bot mentioned this pull request Dec 7, 2020
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