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

Copy pkg/diff to pkg/plugin/diff except DiffStructureds and RenderByCommand #5297

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

Warashi
Copy link
Contributor

@Warashi Warashi commented Oct 28, 2024

What this PR does:

as title.

Why we need it:

We want to use the diff package to implement plugins, so I copied them under the plugin package.

Discussion point:

  1. Do we have to copy the package? Or can we use the pkg/diff from plugin implementations directly?
    I thought we should not use pkg/diff directly from plugin implementations, so I copied them under the plugin package to represent the package as a prepared utility for plugins.
  2. Do we have to copy the whole package at once? Or can we copy the functionality each time we need it?
    I thought we should copy the smallest functionalities set at this time, so I copied not all of the package, but it became almost all. I copied the whole except DiffStructureds and RenderByCommand.

Which issue(s) this PR fixes:

Part of #4980

Does this PR introduce a user-facing change?:

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 78.62903% with 106 lines in your changes missing coverage. Please review.

Project coverage is 25.03%. Comparing base (6512b1f) to head (961c6a9).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pkg/plugin/diff/diff.go 75.08% 55 Missing and 17 partials ⚠️
pkg/plugin/diff/result.go 68.65% 19 Missing and 2 partials ⚠️
pkg/plugin/diff/renderer.go 90.71% 11 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5297      +/-   ##
==========================================
+ Coverage   24.46%   25.03%   +0.56%     
==========================================
  Files         444      447       +3     
  Lines       47024    47520     +496     
==========================================
+ Hits        11506    11896     +390     
- Misses      34602    34687      +85     
- Partials      916      937      +21     

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

@khanhtc1202
Copy link
Member

@Warashi, I got your point 👍
(2) Tbh, the reason why we should copy only needed functions at a time is that the codebase currently contains some "not using anywhere functions," which we want to remove while implementing the new pipedv1 to avoid potential technical debt at the early stage. So, if you can actually understand that the copied code will be used, just not in the moment but in the next step while implementing, I think copying the whole is fine (if you feel moving/copying a part is annoying). But please remember my point of avoiding dead/useless code while coping.

(1) Same as we discussed before, should this be placed under pkg/plugin/diff instead of pkg/app/pipedv1/plugin/diff? 🤔

@Warashi
Copy link
Contributor Author

Warashi commented Oct 28, 2024

@khanhtc1202
Thanks for commenting.
I noticed that we have packages such as pkg/app/pipedv1/plugin/toolregistry, so I placed diff under pkg/app/pipedv1/plugin, but now I think it's better we place this at pkg/plugin/diff.
I'll replace it.

Copy link
Member

@khanhtc1202 khanhtc1202 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you 👍

@t-kikuc
Copy link
Member

t-kikuc commented Oct 28, 2024

@Warashi
The new title is "Copy pkg/diff to pkg/plugin/diff except RenderByCommand",
not "Copy pkg/diff to pkg/app/pipedv1/plugin/diff except RenderByCommand", right?

@Warashi Warashi changed the title Copy pkg/diff to pkg/app/pipedv1/plugin/diff except RenderByCommand Copy pkg/diff to pkg/plugin/diff except DiffStructureds RenderByCommand Oct 29, 2024
@Warashi Warashi changed the title Copy pkg/diff to pkg/plugin/diff except DiffStructureds RenderByCommand Copy pkg/diff to pkg/plugin/diff except DiffStructureds and RenderByCommand Oct 29, 2024
@Warashi
Copy link
Contributor Author

Warashi commented Oct 29, 2024

@t-kikuc
Thanks. I changed the PR title.

@Warashi Warashi merged commit c842a89 into master Oct 29, 2024
18 checks passed
@Warashi Warashi deleted the pipedv1-plugin-diff-package branch October 29, 2024 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants