feat: 根目录文档、脚本、gitignore
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""读回 9 份模版,断言 {name}/{date}/{total} 存在且占位符集合与预期一致。"""
|
||||
import re
|
||||
import sys
|
||||
|
||||
import openpyxl
|
||||
|
||||
OUT_DIR = r'codes/zentao/src/main/resources/templates/scope'
|
||||
|
||||
EXPECTED = {
|
||||
'项目经理考核.xlsx': {'name', 'date', 'total',
|
||||
'workloadPrdScore', 'workloadTeamScore', 'versionPlanFinishedRate', 'bugScore',
|
||||
'documentQualityScore', 'developFeedbackStory', 'systemStabilityScore',
|
||||
'professionalSkillEnhancementScore',
|
||||
'detail_workloadPrdScore', 'detail_workloadTeamScore', 'detail_versionPlanFinishedRate',
|
||||
'detail_bugScore', 'detail_documentQualityScore'},
|
||||
'项目经理考核-王宇航.xlsx': {'name', 'date', 'total',
|
||||
'workloadTeamScore', 'versionPlanFinishedRate', 'bugScore', 'documentQualityScore',
|
||||
'developFeedbackStory', 'systemStabilityScore', 'professionalSkillEnhancementScore',
|
||||
'detail_workloadTeamScore', 'detail_versionPlanFinishedRate', 'detail_bugScore',
|
||||
'detail_documentQualityScore'},
|
||||
'产品经理考核.xlsx': {'name', 'date', 'total',
|
||||
'workloadPrdScore', 'workloadTeamScore', 'productProjectOnTimeRateScore', 'productBugRate',
|
||||
'productProblemResponse', 'productResponsibilityScore',
|
||||
'detail_workloadPrdScore', 'detail_workloadTeamScore',
|
||||
'detail_productProjectOnTimeRateScore', 'detail_productBugRate'},
|
||||
'项目助理考核.xlsx': {'name', 'date', 'total',
|
||||
'workloadPrdScore', 'releaseScore', 'productBugRate', 'productProblemResponse',
|
||||
'productResponsibilityScore',
|
||||
'detail_workloadPrdScore', 'detail_productBugRate'},
|
||||
'后端开发工程师.xlsx': {'name', 'date', 'total',
|
||||
'punctualityScore', 'bugScore', 'codeQualityScore', 'documentQualityScore',
|
||||
'saturationScore', 'workAttitude', 'excellentShare', 'quality',
|
||||
'totalTask', 'delayTask', 'finishPunctuality', 'workTime', 'examineTime', 'saturation',
|
||||
'bugCount', 'bugDensity'},
|
||||
'前端开发工程师.xlsx': {'name', 'date', 'total',
|
||||
'punctualityScore', 'bugScore', 'codeQualityScore', 'saturationScore', 'workAttitude',
|
||||
'excellentShare', 'quality',
|
||||
'totalTask', 'delayTask', 'finishPunctuality', 'workTime', 'examineTime', 'saturation',
|
||||
'bugCount', 'bugDensity'},
|
||||
'测试工程师.xlsx': {'name', 'date', 'total',
|
||||
'punctualityScore', 'documentQualityScore', 'bugFindScore', 'bugScore', 'workAttitude',
|
||||
'excellentShare', 'quality',
|
||||
'totalTask', 'delayTask', 'finishPunctuality', 'devSlightBug', 'devSeriousBug', 'bugFindRate',
|
||||
'slightBug', 'seriousBug'},
|
||||
'UI工程师.xlsx': {'name', 'date', 'total',
|
||||
'punctualityScore', 'designScore', 'workAttitude', 'uiWorkScore', 'excellentShare',
|
||||
'totalTask', 'delayTask', 'finishPunctuality'},
|
||||
'运维工程师.xlsx': {'name', 'date', 'total',
|
||||
'opsMajorTaskScore', 'opsMonitorScore', 'opsInspectScore', 'opsBackupScore', 'otherOpsScore',
|
||||
'systemStabilityScore', 'workAttitude', 'excellentShare',
|
||||
'detail_opsMajorTaskScore', 'detail_opsMonitorScore', 'detail_opsInspectScore',
|
||||
'detail_opsBackupScore'},
|
||||
}
|
||||
|
||||
PLACEHOLDER = re.compile(r'\{([^{}]+)\}')
|
||||
|
||||
failed = False
|
||||
for fname, expected in EXPECTED.items():
|
||||
wb = openpyxl.load_workbook('%s/%s' % (OUT_DIR, fname))
|
||||
ws = wb.active
|
||||
found = set()
|
||||
for row in ws.iter_rows():
|
||||
for cell in row:
|
||||
if isinstance(cell.value, str):
|
||||
found.update(PLACEHOLDER.findall(cell.value))
|
||||
missing_basics = {'name', 'date', 'total'} - found
|
||||
extra = found - expected
|
||||
missing = expected - found
|
||||
status = 'OK ' if not (missing_basics or extra or missing) else 'FAIL'
|
||||
if status == 'FAIL':
|
||||
failed = True
|
||||
print('%s %s (%d placeholders): %s' % (status, fname, len(found), sorted(found)))
|
||||
if missing_basics:
|
||||
print(' missing basics: %s' % sorted(missing_basics))
|
||||
if missing:
|
||||
print(' missing: %s' % sorted(missing))
|
||||
if extra:
|
||||
print(' extra: %s' % sorted(extra))
|
||||
|
||||
print('VALIDATION', 'FAILED' if failed else 'PASSED')
|
||||
sys.exit(1 if failed else 0)
|
||||
Reference in New Issue
Block a user