back port from pychangelogfactory
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -41,3 +41,5 @@ docs
|
||||
helpers-results
|
||||
.coverage
|
||||
/.mypy_cache/
|
||||
.coverage
|
||||
.mypy_cache
|
||||
14
Jenkinsfile
vendored
14
Jenkinsfile
vendored
@@ -398,6 +398,8 @@ pipeline {
|
||||
post {
|
||||
always {
|
||||
dir("gitrepo") {
|
||||
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",
|
||||
@@ -405,6 +407,13 @@ pipeline {
|
||||
allowMissing: false,
|
||||
alwaysLinkToLastBuild: true,
|
||||
keepAll: true])
|
||||
publishHTML([
|
||||
reportDir: "helpers-results/types_check",
|
||||
reportFiles: "index.html",
|
||||
reportName: "types_check",
|
||||
allowMissing: false,
|
||||
alwaysLinkToLastBuild: true,
|
||||
keepAll: true])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -482,11 +491,6 @@ pipeline {
|
||||
badge_coverage.setStatus(sz_full_rate)
|
||||
badge_coverage.setColor(getColorScale(full_rate))
|
||||
|
||||
//complexity = new BigDecimal( 10*GetCoverageValue_complexity(coverage_report_path))
|
||||
//sz_complexity = complexity.setScale(2, RoundingMode.HALF_EVEN).toString()
|
||||
//badge_complexity.setStatus(sz_complexity)
|
||||
//badge_quality.setColor(getColorScale_reversed(complexity))
|
||||
|
||||
//badge_maintainability
|
||||
records = readCSV file: 'helpers-results/complexity_check/MI.csv'
|
||||
maintainability = records[1][1]
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -24,22 +24,18 @@ class types_check(helper_withresults_base):
|
||||
print("checking code typing ...")
|
||||
result = api.run(
|
||||
[ # project path
|
||||
"-m",
|
||||
"src." + str(cls.pyproject["project"]["name"]),
|
||||
"-p",
|
||||
"src.pychangelogfactory",
|
||||
# analysis configuration
|
||||
"--ignore-missing-imports",
|
||||
"--strict-equality",
|
||||
# "--show-traceback",
|
||||
"--explicit-package-bases",
|
||||
# "--strict-equality",
|
||||
# "--check-untyped-defs",
|
||||
# reports generation
|
||||
"--cobertura-xml-report",
|
||||
str(cls.get_result_dir()),
|
||||
"--html-report",
|
||||
str(cls.get_result_dir()),
|
||||
"--linecount-report",
|
||||
str(cls.get_result_dir()),
|
||||
"--linecoverage-report",
|
||||
str(cls.get_result_dir()),
|
||||
"--lineprecision-report",
|
||||
str(cls.get_result_dir()),
|
||||
"--txt-report",
|
||||
str(cls.get_result_dir()),
|
||||
"--xml-report",
|
||||
@@ -52,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")
|
||||
|
||||
Reference in New Issue
Block a user