Xline
Xline copied to clipboard
refactor: split config into multiple modules
-
what problem are you trying to solve? (or if there's no problem, what's the motivation for this change?) -> Fixes #604 -> Currently all configurations are in a single file,
utils/src/config.rs
οΌIt also contains a lot ofparse_xxx
,xxx_format
,default_xxx
methods, It's messy and difficult to manage. This PR organizes these configurations into modules, each containing the configuration itself, its parse method, and default values. -
what changes does this pull request make? -> It adds a different folder structure and splits every config struct into a separate module. I plan on replacing new method with a more flexible builder method.
-
are there any non-obvious implications of these changes? (does it break compatibility with previous versions, etc) -> Not yet, although a builder refactor could mean little rewrites in curp
I'll refactor the new methods into builder methods into another commit. Before doing that just some wanted feedback if possible.
@Harsh1s Convert your pr to draft since CI failed
@Harsh1s Your PR is in conflict and cannot be merged.
Hi, @Harsh1s ! This pr has been stalled for 2 months. Would you like to update it? π
Hi, @Harsh1s ! This pr has been stalled for 2 months. Would you like to update it? π
I am so very sorry, I assure you I'll update it within a day.
@Phoenix500526 I redid the refactor with latest changes, I still have to rewrite new methods into builder pattern which I'll do by EOD. Could you please review if current refactor is fine? I'll do the builder rewrite in the meantime.
@Harsh1s Convert your pr to draft since CI failed
Codecov Report
Attention: Patch coverage is 89.13325%
with 84 lines
in your changes are missing coverage. Please review.
Project coverage is 75.54%. Comparing base (
e35b35a
) to head (3482952
). Report is 84 commits behind head on master.
:exclamation: Current head 3482952 differs from pull request most recent head 93f0429
Please upload reports for the commit 93f0429 to get more accurate results.
Additional details and impacted files
@@ Coverage Diff @@
## master #676 +/- ##
==========================================
- Coverage 75.55% 75.54% -0.02%
==========================================
Files 180 198 +18
Lines 26938 27496 +558
Branches 26938 27496 +558
==========================================
+ Hits 20353 20771 +418
- Misses 5366 5446 +80
- Partials 1219 1279 +60
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi, @Harsh1s I've rebased this pr and modify the code to pass the ci process.
Thanks for the help @Phoenix500526 , I've pulled the changes and I'll address all your reviews now. I also started working on builder patterns for all the structs, I'll make commits one by one.
@Harsh1s Convert your pr to draft since CI failed
Hi, @Harsh1s! IMO, to implement the builder pattern for all these XXConfig structures may not be a good practice. I only recommend implementing the builder pattern for those XXConfig structures with too many arguments in their constructor. BTW, to pass the commit message validation ci task, please use "refactor(config)" or "refactor" to replace the "refactor-config" in your commit message. π
Hi, @Harsh1s! IMO, to implement the builder pattern for all these XXConfig structures may not be a good practice. I only recommend implementing the builder pattern for those XXConfig structures with too many arguments in their constructor. BTW, to pass the commit message validation ci task, please use "refactor(config)" or "refactor" to replace the "refactor-config" in your commit message. π
Understood, thank you so much for all the help and being so patient with me!
We also provide the .pre-commit-config.yaml
in our project root. You can execute the pre-commit install
command at the project root to install the git hook. It will automatically run the cargo fmt
, cargo clippy
and validate the commit message for you before you commit your code modifications. I think it's helpful.
We also provide the
.pre-commit-config.yaml
in our project root. You can execute thepre-commit install
command at the project root to install the git hook. It will automatically run thecargo fmt
,cargo clippy
and validate the commit message for you before you commit your code modifications. I think it's helpful.
Okay, will do. Thanks!
It has been a while since there was any activity on this pull request. Unfortunately, we have decided to close this PR for now.
If you're still interested in contributing this change, please reopen this pr. Alternatively, if you could provide an update or a status on your end, that would also be very helpful.
Thank you for your contribution!