git-cliff
git-cliff copied to clipboard
feat(config): Allow overriding of remote API URL
Description
This PR aims to simplify the configuration of remote API URL for a particular remote by adding the option in the remote section.
Motivation and Context
Up until now, an environment variable needed to be set such as GITLAB_API_URL_ENV
fixes #704
How Has This Been Tested?
I only ran the existing tests, as I was unsure of where tests for this feature would have to be added. If there's a particular place I should consider adding them in, let me know.
Screenshots / Logs (if applicable)
Types of Changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation (no code change)
- [x] Refactor (refactoring production code)
- [ ] Other
Checklist:
- [x] My code follows the code style of this project.
- [x] I have updated the documentation accordingly.
- [x] I have formatted the code with rustfmt.
- [x] I checked the lints with clippy.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
Questions
The change introduces a refactor which I wouldn't consider a breaking change. The functionality is preserved but essentially the api_url() method in the RemoteClient has now a default implementation which leverages on the constants API_URL and API_URL_ENV which allows us to just implements the various traits by setting the appropriate constants without duplicating the code.
I have two questions related to this:
- Is this a welcomed refactor?
- In the following code:
https://github.com/pauliyobo/git-cliff/blob/c2398dc452b0f8c3aef1a3f7db8c6748a6de7f24/git-cliff-core/src/repo.rs#L397-L444
I wasn't sure of whether the returned upstream remote should also have its proper api_url set. Is that the case? I have left it on None for now.
Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️
Codecov Report
Attention: Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.
Project coverage is 43.35%. Comparing base (
d0848ff) to head (e80ca3e). Report is 1 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| git-cliff-core/src/remote/mod.rs | 0.00% | 6 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #896 +/- ##
==========================================
+ Coverage 43.14% 43.35% +0.21%
==========================================
Files 21 21
Lines 1718 1712 -6
==========================================
+ Hits 741 742 +1
+ Misses 977 970 -7
| Flag | Coverage Δ | |
|---|---|---|
| unit-tests | 43.35% <25.00%> (+0.21%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🚨 Try these New Features:
- Flaky Tests Detection - Detect and resolve failed and flaky tests
- JS Bundle Analysis - Avoid shipping oversized bundles
Hello, thanks for the PR! I pushed some nitpicks & refactored the remote handling a bit not to keep you waiting any longer :) Now, when it comes to your questions:
I only ran the existing tests, as I was unsure of where tests for this feature would have to be added. If there's a particular place I should consider adding them in, let me know.
Yup, we should add a fixture test to make sure this is working. I would suggest copying test-gitlab-integration and using a project hosted on a custom GitLab instance (e.g. arch-repro-status.
Also, I couldn't see the part where we override the remote URL with the value taken from config yet. We should probably do that as well.
Is this a welcomed refactor?
Yup, I think it's good :)
I wasn't sure of whether the returned upstream remote should also have its proper api_url set.
Not really, this should be left like this for now.
Sorry for the delayed review, would you be able to address these sometime? 😊
Hello, thanks for the feedback. I'm a bit busy this week, will try to get something out by the next. Thank you.
Congrats on merging your first pull request! ⛰️