Resolve pylint errors in common.py

This commit is contained in:
bom 2023-04-28 14:57:19 +02:00 committed by Michael Jerger
parent bc7d8e1d87
commit e0b30adf9f
2 changed files with 8 additions and 6 deletions

View file

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

View file

@ -1,6 +1,8 @@
import deprecation
from enum import Enum
from typing import List
import logging
import deprecation
def filter_none(list_to_filter):
return [x for x in list_to_filter if x is not None]
@ -10,15 +12,15 @@ class Validateable:
value = self.__dict__[field_name]
if value is None or value == "":
return [f"Field '{field_name}' must not be empty."]
else:
return []
return []
def validate(self) -> List[str]:
return []
def is_valid(self) -> bool:
return len(self.validate()) < 1
def throw_if_invalid(self):
if not self.is_valid():
issues = '\n'.join(self.validate())
@ -65,13 +67,13 @@ class Devops(Validateable):
def __put__(self, key, value):
self.stack[key] = value
def __get__(self, key):
def __get(self, key):
return self.stack[key]
def __get_keys__(self, keys):
result = {}
for key in keys:
result[key] = self.__get__(key)
result[key] = self.__get(key)
return result
class BuildType(Enum):