Skip to content
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

Refacter code to use new ObjectType #2121

Merged
merged 3 commits into from
Jun 12, 2024

Conversation

sarthyparty
Copy link
Contributor

@sarthyparty sarthyparty commented Jun 10, 2024

Proposed changes

Problem: We currently use the variable objType to refer to a client.Object's type (skeleton of an object). We also use the variable obj to refer to a full client.Object (object with fields filled out). However, in many parts of the codebase these two variables are used closely together and are both of type client.Object which can be a little confusing.

Solution: I created a new type called ObjectType and refactored the codebase to utilize it.

Closes #1456

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

NONE

@github-actions github-actions bot added the tech-debt Short-term pain, long-term benefit label Jun 10, 2024
@sarthyparty sarthyparty force-pushed the debt/add-object-type branch 2 times, most recently from 5407df1 to a62a090 Compare June 11, 2024 19:24
@nginxinc nginxinc deleted a comment from codecov bot Jun 11, 2024
Problem: We currently use the variable objType
to refer to a client.Object's type (skeleton of
an object). We also use the variable obj to refer
to a full client.Object (object with fields filled
out). However, in many parts of the codebase these
two variables are used closely together and are
both of type client.Object which can be a little
confusing.

Solution: I created a new type called ObjectType
and refactored the codebase to utilize it.
@sarthyparty sarthyparty force-pushed the debt/add-object-type branch from a62a090 to 9038ea2 Compare June 11, 2024 19:27
Copy link

codecov bot commented Jun 11, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.61%. Comparing base (b429f74) to head (34708f7).

Files Patch % Lines
internal/mode/provisioner/manager.go 0.00% 1 Missing ⚠️
internal/mode/static/manager.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2121   +/-   ##
=======================================
  Coverage   87.61%   87.61%           
=======================================
  Files          96       96           
  Lines        6694     6695    +1     
  Branches       50       50           
=======================================
+ Hits         5865     5866    +1     
  Misses        773      773           
  Partials       56       56           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sarthyparty sarthyparty marked this pull request as ready for review June 11, 2024 19:36
@sarthyparty sarthyparty requested a review from a team as a code owner June 11, 2024 19:36
@kate-osborn
Copy link
Contributor

Let's also use the new type in the following places:

@pleshakov or @bjee19 any other places we should update this type?

internal/framework/types/types.go Outdated Show resolved Hide resolved
@sarthyparty sarthyparty requested a review from kate-osborn June 11, 2024 22:12
@bjee19
Copy link
Contributor

bjee19 commented Jun 11, 2024

@bjee19 any other places we should update this type?

looks good to me! couldn't find any other places, @sarthyparty good job on being thorough!

Copy link
Contributor

@kate-osborn kate-osborn left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@kate-osborn kate-osborn requested a review from a team June 11, 2024 22:51
Copy link
Contributor

@bjee19 bjee19 left a comment

Choose a reason for hiding this comment

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

🚀 🚀 🚀

@sarthyparty sarthyparty enabled auto-merge (squash) June 12, 2024 17:20
@sarthyparty sarthyparty disabled auto-merge June 12, 2024 17:20
@sarthyparty sarthyparty enabled auto-merge (squash) June 12, 2024 17:21
@sarthyparty sarthyparty merged commit 7654cb6 into nginxinc:main Jun 12, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Short-term pain, long-term benefit
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Reduce complexity around client.object type switches
4 participants