Fix pylint messages for repo
This commit is contained in:
parent
0214cdd99a
commit
9db91c0a16
1 changed files with 33 additions and 32 deletions
|
@ -23,9 +23,8 @@ class VersionRepository:
|
||||||
|
|
||||||
def write_file(self, version_string):
|
def write_file(self, version_string):
|
||||||
if self.file_handler is None:
|
if self.file_handler is None:
|
||||||
raise Exception("Version was not created by load_file method.")
|
raise RuntimeError("Version was not created by load_file method.")
|
||||||
else:
|
self.file_handler.write(version_string)
|
||||||
self.file_handler.write(version_string)
|
|
||||||
|
|
||||||
def parse_file(self):
|
def parse_file(self):
|
||||||
version_list, is_snapshot = self.file_handler.parse()
|
version_list, is_snapshot = self.file_handler.parse()
|
||||||
|
@ -53,29 +52,30 @@ class ReleaseTypeRepository:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_git(cls, git_api: GitApi):
|
def from_git(cls, git_api: GitApi):
|
||||||
releaseTypeRepo = cls(git_api=git_api)
|
release_type_repo = cls(git_api=git_api)
|
||||||
releaseTypeRepo.get_from_git = True
|
release_type_repo.get_from_git = True
|
||||||
return releaseTypeRepo
|
return release_type_repo
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_environment(cls, environment_api: EnvironmentApi):
|
def from_environment(cls, environment_api: EnvironmentApi):
|
||||||
releaseTypeRepo = cls(environment_api=environment_api)
|
release_type_repo = cls(environment_api=environment_api)
|
||||||
releaseTypeRepo.get_from_env = True
|
release_type_repo.get_from_env = True
|
||||||
return releaseTypeRepo
|
return release_type_repo
|
||||||
|
|
||||||
def __get_release_type_git(self) -> ReleaseType | None:
|
def __get_release_type_git(self) -> ReleaseType | None:
|
||||||
latest_commit = self.git_api.get_latest_commit()
|
latest_commit = self.git_api.get_latest_commit()
|
||||||
|
|
||||||
if ReleaseType.MAJOR.name in latest_commit.upper():
|
match latest_commit.upper():
|
||||||
return ReleaseType.MAJOR
|
case ReleaseType.MAJOR.name:
|
||||||
elif ReleaseType.MINOR.name in latest_commit.upper():
|
return ReleaseType.MAJOR
|
||||||
return ReleaseType.MINOR
|
case ReleaseType.MINOR.name:
|
||||||
elif ReleaseType.PATCH.name in latest_commit.upper():
|
return ReleaseType.MINOR
|
||||||
return ReleaseType.PATCH
|
case ReleaseType.PATCH.name:
|
||||||
elif ReleaseType.SNAPSHOT.name in latest_commit.upper():
|
return ReleaseType.PATCH
|
||||||
return ReleaseType.SNAPSHOT
|
case ReleaseType.SNAPSHOT.name:
|
||||||
else:
|
return ReleaseType.SNAPSHOT
|
||||||
return None
|
case _:
|
||||||
|
return None
|
||||||
|
|
||||||
def __get_release_type_environment(self) -> ReleaseType | None:
|
def __get_release_type_environment(self) -> ReleaseType | None:
|
||||||
release_name = self.environment_api.get(
|
release_name = self.environment_api.get(
|
||||||
|
@ -86,24 +86,25 @@ class ReleaseTypeRepository:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Release Name not found. Is the Environment correctly configured?"
|
"Release Name not found. Is the Environment correctly configured?"
|
||||||
)
|
)
|
||||||
elif ReleaseType.MAJOR.name in release_name.upper():
|
|
||||||
return ReleaseType.MAJOR
|
match release_name.upper():
|
||||||
elif ReleaseType.MINOR.name in release_name.upper():
|
case ReleaseType.MAJOR.name:
|
||||||
return ReleaseType.MINOR
|
return ReleaseType.MAJOR
|
||||||
elif ReleaseType.PATCH.name in release_name.upper():
|
case ReleaseType.MINOR.name:
|
||||||
return ReleaseType.PATCH
|
return ReleaseType.MINOR
|
||||||
elif ReleaseType.SNAPSHOT.name in release_name.upper():
|
case ReleaseType.PATCH.name:
|
||||||
return ReleaseType.SNAPSHOT
|
return ReleaseType.PATCH
|
||||||
else:
|
case ReleaseType.SNAPSHOT.name:
|
||||||
return None
|
return ReleaseType.SNAPSHOT
|
||||||
|
case _:
|
||||||
|
return None
|
||||||
|
|
||||||
def get_release_type(self) -> ReleaseType | None:
|
def get_release_type(self) -> ReleaseType | None:
|
||||||
if self.get_from_git:
|
if self.get_from_git:
|
||||||
return self.__get_release_type_git()
|
return self.__get_release_type_git()
|
||||||
elif self.get_from_env:
|
if self.get_from_env:
|
||||||
return self.__get_release_type_environment()
|
return self.__get_release_type_environment()
|
||||||
else:
|
raise ValueError("No valid api passed to ReleaseTypeRepository")
|
||||||
raise ValueError("No valid api passed to ReleaseTypeRepository")
|
|
||||||
|
|
||||||
|
|
||||||
class ReleaseContextRepository:
|
class ReleaseContextRepository:
|
||||||
|
|
Loading…
Reference in a new issue