Resolve pylint errors in release.py

This commit is contained in:
bom 2023-04-28 14:50:35 +02:00
parent 2463d36674
commit c70daa346d
2 changed files with 8 additions and 8 deletions

View file

@ -27,7 +27,7 @@ pylint:
stage: lint&test stage: lint&test
script: script:
- pip install -r dev_requirements.txt - pip install -r dev_requirements.txt
- pylint -d W0511,R0903,C0301,W0614,C0114,C0115,C0116,similarities,W0702,W0702,R0913,R0902,R0914,R1732 src/main/python/ddadevops/ - pylint -d W0511,R0903,C0301,W0614,C0114,C0115,C0116,similarities,W0719,W0702,W0702,R0913,R0902,R0914,R1732 src/main/python/ddadevops/
pytest: pytest:
stage: lint&test stage: lint&test

View file

@ -18,8 +18,8 @@ class EnvironmentKeys(Enum):
class Version(): class Version():
def __init__(self, id: Path, version_list: list): def __init__(self, path: Path, version_list: list):
self.id = id self.path = path
self.version_list = version_list self.version_list = version_list
self.version_string: Optional[str | None] = None self.version_string: Optional[str | None] = None
self.is_snapshot: Optional[bool | None] = None self.is_snapshot: Optional[bool | None] = None
@ -42,7 +42,7 @@ class Version():
self.version_list[ReleaseType.MINOR.value] = 0 self.version_list[ReleaseType.MINOR.value] = 0
self.version_list[ReleaseType.MAJOR.value] += 1 self.version_list[ReleaseType.MAJOR.value] += 1
case None: case None:
raise Exception("Release Type was not set!") raise RuntimeError("Release Type was not set!")
def get_version_string(self) -> str: def get_version_string(self) -> str:
self.version_string = ".".join([str(x) for x in self.version_list]) self.version_string = ".".join([str(x) for x in self.version_list])
@ -51,13 +51,13 @@ class Version():
return self.version_string return self.version_string
def create_release_version(self, release_type: ReleaseType | None): def create_release_version(self, release_type: ReleaseType | None):
release_version = Version(self.id, self.version_list.copy()) release_version = Version(self.path, self.version_list.copy())
release_version.is_snapshot = self.is_snapshot release_version.is_snapshot = self.is_snapshot
release_version.increment(release_type) release_version.increment(release_type)
return release_version return release_version
def create_bump_version(self): def create_bump_version(self):
bump_version = Version(self.id, self.version_list.copy()) bump_version = Version(self.path, self.version_list.copy())
bump_version.is_snapshot = self.is_snapshot bump_version.is_snapshot = self.is_snapshot
bump_version.increment(ReleaseType.BUMP) bump_version.increment(ReleaseType.BUMP)
return bump_version return bump_version
@ -99,9 +99,9 @@ class Release(Validateable):
self.config_file = config_file self.config_file = config_file
self.release_context: ReleaseContext | None = None self.release_context: ReleaseContext | None = None
def set_release_context(self, set_release_context: ReleaseContext): def set_release_context(self, set_release_context: ReleaseContext):
self.release_context = set_release_context self.release_context = set_release_context
def release_version(self): def release_version(self):
return self.release_context.release_version() return self.release_context.release_version()