Resolve pylint errors in common.py
This commit is contained in:
parent
c70daa346d
commit
837b58d5b8
2 changed files with 11 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import deprecation
|
||||
import logging
|
||||
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 +10,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())
|
||||
|
@ -46,7 +46,7 @@ class Devops(Validateable):
|
|||
self.stage = stage
|
||||
self.name = name
|
||||
self.project_root_path = project_root_path
|
||||
logging.warn(f"Set project root in DevOps {self.project_root_path}")
|
||||
logging.warning(f"Set project root in DevOps {self.project_root_path}")
|
||||
self.module = module
|
||||
if not name:
|
||||
self.name = module
|
||||
|
@ -56,22 +56,23 @@ class Devops(Validateable):
|
|||
|
||||
@deprecation.deprecated(deprecated_in="3.2")
|
||||
# use .name instead
|
||||
#pylint: disable=method-hidden
|
||||
def name(self):
|
||||
return self.name
|
||||
|
||||
def build_path(self):
|
||||
path = [self.project_root_path, self.build_dir_name, self.name, self.module]
|
||||
logging.warn(f"Set project build_path in Devops {path}")
|
||||
logging.warning(f"Set project build_path in Devops {path}")
|
||||
return "/".join(filter_none(path))
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue