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

refactor: try to refactor the load config code to 2 clear pathes #814

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

qs-wang
Copy link

@qs-wang qs-wang commented Jan 11, 2025

  • split loadConfigByProvider to a separate method to make if/else statement clearer
  • split loadPrivateConfigFromFile to a separate method for reuse in if/else branches

I tried to make some changes for my own purpose. While I read the code although the code works perfectly, it a little bit hard to understand and change because the config loading logic from the provider and file are mixed. I refactored it to split the loading logic , i.e. loading from provider and file, to 2 methods, which made my changes easier. Later on I found other solution so the changes got dropped, but I am trying to push the refactor to see if anyone is interested.

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/go-mod-bootstrap/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • [y] I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • [y] I am not introducing a new dependency (add notes below if you are)
  • [n] I have added unit tests for the new feature or bug fix (if not, why?) refactoring the code, should not change any logic, passed all existing test
  • [y] I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • [n] I have opened a PR for the related docs change (if not, why?) refactoring code, no doc change is needed

Testing Instructions

New Dependency Instructions (If applicable)

@qs-wang qs-wang force-pushed the refactor/load-config branch 5 times, most recently from d3f9d8c to f6565fc Compare January 11, 2025 11:05
@cloudxxx8 cloudxxx8 requested a review from jackchenjc January 23, 2025 02:23
Copy link
Contributor

@jackchenjc jackchenjc left a comment

Choose a reason for hiding this comment

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

Hi @qs-wang,

Thanks for the refactoring. I've left a comment below about a minor detail I noticed.

@qs-wang qs-wang force-pushed the refactor/load-config branch from 6a77bba to 91d412a Compare January 27, 2025 07:45
…th clearly

- split loadConfigByProvider to a separate method to make if/else statemtn clearer
- split loadPrivateConfigFromFile to a separate method for reuse in if/else branches

Signed-off-by: Q.s <[email protected]>
@qs-wang qs-wang force-pushed the refactor/load-config branch from 91d412a to 7123958 Compare January 27, 2025 08:56
@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 78 lines in your changes missing coverage. Please review.

Project coverage is 46.20%. Comparing base (53b414d) to head (f4834ce).

Files with missing lines Patch % Lines
bootstrap/config/config.go 0.00% 78 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #814      +/-   ##
==========================================
- Coverage   46.51%   46.20%   -0.31%     
==========================================
  Files          62       62              
  Lines        3603     3627      +24     
==========================================
  Hits         1676     1676              
- Misses       1805     1829      +24     
  Partials      122      122              

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

@qs-wang qs-wang force-pushed the refactor/load-config branch from 7123958 to 989def7 Compare January 27, 2025 09:20
@qs-wang qs-wang force-pushed the refactor/load-config branch from 989def7 to f4834ce Compare January 27, 2025 09:20
@qs-wang qs-wang requested a review from jackchenjc January 27, 2025 22:21
@qs-wang qs-wang changed the title refactor: try to refactor the load config coode to 2 clear pathes refactor: try to refactor the load config code to 2 clear pathes Jan 28, 2025
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