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 the LocalProject #189
Refactor the LocalProject #189
Conversation
3d4e469
to
64417ea
Compare
packit/local_project.py
Outdated
or self._parse_repo_name_from_git_project() | ||
or self._parse_namespace_from_git_project() | ||
or self._parse_git_url_from_git_repo() | ||
or self._parse_namespace_from_git_repo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need so many functions? Are we using all of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, not all of them, but I would like to compute as much as we can, so it can be useful in other projects as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is read a bit more, but I would like to see, what part is called in such cases.
I don't see a reference from CLI and I would like to see it.
But It is maybe more complicated.
packit/local_project.py
Outdated
return False | ||
|
||
def _parse_namespace_from_git_repo(self): | ||
if self.git_repo and not self.namespace: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about to add there use case when it is called? like LocalProject(git_url, git_service=).
Or maybe even what command use it like propose-update
uses two of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. If you want to see how the class is being utilized, just open pyčarm and press alt+f7
and that's your most up-to-date answer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alt+f7
is doing some funny window resizing in my case. What action do you have in mind?
Sorry, I do not understand what you want. (This class differs the one defining the CLI parameter type) |
LGTM |
I would like to improve tests as well. Please, wait for that. |
Franto, I understand that you want to support as many use cases as possible; what I'd like to see here personally, is to scope the functionality down: look at how we are using it and only support that: to have a few class methods which accept only 2-3 arguments and would be able to return full instance of local_project; WDYT? |
- full_name: "$namespace/$repo" | ||
- namespace: namespace of the remote project | ||
- repo_name: name of the remote project | ||
- path_or_url: working_dir if the directory exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about we removed this parameter and performed the check in a dedicated function? then we could pass the path or url to LocalProject
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, we need to check this in multiple places. (All CLI functions.)
Current usecases:
For all of them, you can specify We can probably:
I do not think we can remove any other attribute, since we need to calculate it anyway. I am not sure I got the benefit of multiple class methods. Personally, I would like to move the class to ogr, where the general sollution makes more sense. |
edit: I'll send tests later. |
I've made a test for each call of |
Signed-off-by: Frantisek Lachman <flachman@redhat.com>
Signed-off-by: Frantisek Lachman <flachman@redhat.com>
Signed-off-by: Frantisek Lachman <flachman@redhat.com>
Signed-off-by: Frantisek Lachman <flachman@redhat.com>
Signed-off-by: Frantisek Lachman <flachman@redhat.com>
Signed-off-by: Frantisek Lachman <flachman@redhat.com>
e2a1013
to
f0219be
Compare
Resolves #178