fix typing coverage and completion
This commit is contained in:
3
Jenkinsfile
vendored
3
Jenkinsfile
vendored
@@ -398,7 +398,8 @@ pipeline {
|
||||
post {
|
||||
always {
|
||||
dir("gitrepo") {
|
||||
publishCoverage adapters: [cobertura(mergeToOneReport: true, path: "helpers-results/types_check/cobertura.xml")]
|
||||
publishCoverage adapters: [cobertura(mergeToOneReport: true, path: "helpers-results/types_check/cobertura.xml")]
|
||||
junit 'helpers-results/types_check/junit.xml'
|
||||
publishHTML([
|
||||
reportDir: "helpers-results/quality_check",
|
||||
reportFiles: "report.html",
|
||||
|
||||
@@ -57,10 +57,11 @@ class helper_base(ABC):
|
||||
return process.stdout
|
||||
|
||||
@classmethod
|
||||
def run_cmd(cls, cmdarray):
|
||||
def run_cmd(cls, cmdarray, silent: bool = False):
|
||||
p = subprocess.run(cmdarray, capture_output=True)
|
||||
print(p.stdout)
|
||||
print(p.stderr)
|
||||
if not silent:
|
||||
print(p.stdout.decode())
|
||||
print(p.stderr.decode())
|
||||
return p.stdout
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class quality_check(helper_withresults_base):
|
||||
def GetPylintMessageList(cls):
|
||||
Messagelist = dict()
|
||||
regex = r"^:([a-zA-Z-]+) \(([^\)]+)\)"
|
||||
for line in cls.run_cmd([sys.executable, "-m", "pylint", "--list-msgs"]).splitlines():
|
||||
for line in cls.run_cmd([sys.executable, "-m", "pylint", "--list-msgs"], True).splitlines():
|
||||
if res := re.search(regex, line.decode()):
|
||||
Messagelist[res.group(1)] = res.group(2)
|
||||
cls.PylintMessageList = Messagelist
|
||||
@@ -52,6 +52,7 @@ class quality_check(helper_withresults_base):
|
||||
@classmethod
|
||||
def do_job(cls):
|
||||
print("checking code quality ...")
|
||||
|
||||
cls.GetPylintMessageList()
|
||||
|
||||
RES_all = dict()
|
||||
|
||||
@@ -30,6 +30,7 @@ class types_check(helper_withresults_base):
|
||||
"--show-traceback",
|
||||
"--explicit-package-bases",
|
||||
"--strict-equality",
|
||||
"--check-untyped-defs",
|
||||
# reports generation
|
||||
"--cobertura-xml-report",
|
||||
str(cls.get_result_dir()),
|
||||
@@ -47,6 +48,9 @@ class types_check(helper_withresults_base):
|
||||
if result[0]:
|
||||
print("\nType checking report:\n")
|
||||
print(result[0]) # stdout
|
||||
# converting the report using pylint_json2html (/!\ internal API, but as their is no leading '_' ...)
|
||||
with open(cls.get_result_dir() / "raw_eport.txt", "w+", encoding="utf-8") as Outfile:
|
||||
Outfile.write(result[0])
|
||||
|
||||
if result[1]:
|
||||
print("\nError report:\n")
|
||||
|
||||
@@ -62,12 +62,11 @@ class ChangelogFormater(ABC):
|
||||
title: None | str = None
|
||||
keywords: None | list[str] = None
|
||||
priority: int = 0
|
||||
|
||||
_lines: list[None | str] = []
|
||||
|
||||
def __init__(self):
|
||||
"""ChangelogFormater class constructor"""
|
||||
self._lines = []
|
||||
self._lines: list[None | str] = []
|
||||
|
||||
def Clear(self) -> None:
|
||||
"""Clear the formater content"""
|
||||
@@ -103,7 +102,7 @@ class ChangelogFormater(ABC):
|
||||
return full_lines
|
||||
|
||||
@classmethod
|
||||
def CheckLine(cls, content: str) -> re.Match:
|
||||
def CheckLine(cls, content: str) -> None | re.Match:
|
||||
"""Check if a line match the current formater (lazy identification)
|
||||
|
||||
/// warning
|
||||
@@ -132,9 +131,10 @@ class ChangelogFormater(ABC):
|
||||
True if a keyword has matched, False otherwise
|
||||
"""
|
||||
keyword_list = cls.keywords
|
||||
for _keyword in keyword_list:
|
||||
if (_keyword != "") and re.search(_keyword, content):
|
||||
return True
|
||||
if keyword_list:
|
||||
for _keyword in keyword_list:
|
||||
if _keyword and re.search(_keyword, content):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ class ChangelogFactory:
|
||||
"""The main changelog class"""
|
||||
|
||||
ar_FormaterKlass: set[type[ChangelogFormater]] = set()
|
||||
ar_Formater: None | dict[ChangelogFormater] = None
|
||||
ar_Formater: dict[str, ChangelogFormater] = {}
|
||||
checkCommentPattern: str = r"^[ \t]*(?:\/\/|#)"
|
||||
|
||||
def __init__(self, ChangelogString: None | str = None):
|
||||
@@ -151,7 +151,7 @@ class ChangelogFactory:
|
||||
Args:
|
||||
ChangelogString: optionnal input string to start with
|
||||
"""
|
||||
self.ar_Formater = {}
|
||||
self.ar_Formater: dict[str, ChangelogFormater] = {}
|
||||
self.ar_FormaterKlass = self.ar_FormaterKlass.copy()
|
||||
|
||||
for FormaterKlass in self.ar_FormaterKlass:
|
||||
@@ -160,7 +160,7 @@ class ChangelogFactory:
|
||||
if isinstance(ChangelogString, str):
|
||||
self.ProcessFullChangelog(ChangelogString)
|
||||
|
||||
def ResetFormaterList(self=None) -> None | ChangelogFactory:
|
||||
def ResetFormaterList(self: None | ChangelogFactory = None) -> None | ChangelogFactory:
|
||||
"""Reset the formater class list to original
|
||||
|
||||
This method can be call both from class or from instance.
|
||||
@@ -181,7 +181,7 @@ class ChangelogFactory:
|
||||
ChangelogFactory.ar_FormaterKlass = _savedFormaterList.copy()
|
||||
return None
|
||||
|
||||
def RegisterFormater(self, FormaterKlass: ChangelogFormater) -> None:
|
||||
def RegisterFormater(self, FormaterKlass: type[ChangelogFormater]) -> ChangelogFactory:
|
||||
"""Register a new formater in the current instance
|
||||
|
||||
Args:
|
||||
@@ -193,7 +193,7 @@ class ChangelogFactory:
|
||||
self.ar_Formater[FormaterKlass.__name__] = FormaterKlass()
|
||||
return self
|
||||
|
||||
def unRegisterFormater(self, FormaterKlass: ChangelogFormater) -> None:
|
||||
def unRegisterFormater(self, FormaterKlass: type[ChangelogFormater]) -> ChangelogFactory:
|
||||
"""unRegister a new formater in the current instance
|
||||
|
||||
Args:
|
||||
|
||||
Reference in New Issue
Block a user