-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use pathlib.Path for path functionality #217
Conversation
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.
lgtm 👍
(The mocking was already ugly before. can be addressed later)
@@ -35,7 +35,7 @@ def finalize(self) -> None: | |||
|
|||
def get_full_file_path(self, relative_path: str) -> str: | |||
repo = self.__get_repo() | |||
return os.path.join(str(repo.working_dir), relative_path) | |||
return str(Path(repo.working_dir) / relative_path) |
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.
Could directly return Path object here. It's re-wrapped everywhere anyways
if preview_env_already_exist: | ||
logging.info("Use existing folder for preview: %s", preview_namespace) | ||
return False | ||
logging.info("Create new folder for preview: %s", preview_namespace) | ||
full_preview_template_folder_path = template_git_repo.get_full_file_path(gitops_config.preview_template_path) | ||
if not os.path.isdir(full_preview_template_folder_path): | ||
if not Path(full_preview_template_folder_path).is_dir(): |
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 wonder if we could extract those checks into a separate dependency to prevent the need to continue to do this ugly monkey patching. Something like path_checker.is_dir(full_preview_template_folder_path)
🎉 This issue has been resolved in version 5.9.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Get rid of the last part of dedicated file based rule exclusion from the migration to ruff.
It might be a good idea to use Path class in a future patch more consistently throughout the code.