110 lines
2.4 KiB
Go
110 lines
2.4 KiB
Go
package workflowdef
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// rdevTemplateDepthAllowlist 已补强模板;随 S0/S1 批次增长。
|
|
var rdevTemplateDepthAllowlist = []string{
|
|
"rd_design_input_spec",
|
|
"rd_proposal",
|
|
"rd_design_input_list",
|
|
"rd_system_design",
|
|
"rd_regs_stds",
|
|
"rd_adverse_events",
|
|
"rd_sw_plan",
|
|
"rd_sw_reqs",
|
|
"rd_sw_config",
|
|
"rd_risk_plan",
|
|
"rd_design_plan",
|
|
"rd_user_needs",
|
|
"rd_hazard_analysis",
|
|
"rd_system_reqs",
|
|
"rd_planning_review",
|
|
"rd_req_review",
|
|
"rd_input_phase_review",
|
|
"rd_output_review",
|
|
"rd_verification_review",
|
|
"rd_transfer_review",
|
|
"rd_drawings_3d",
|
|
"rd_product_bom",
|
|
"rd_ee_bom",
|
|
"rd_pcba",
|
|
"rd_electrical_sys",
|
|
"rd_process_flow",
|
|
"rd_packaging",
|
|
"rd_purchase_spec",
|
|
"rd_sw_arch",
|
|
"rd_sw_ui",
|
|
"rd_ifu",
|
|
"rd_incoming_iqc",
|
|
"rd_ipqc",
|
|
"rd_fqc",
|
|
"rd_tech_req",
|
|
"rd_risk_report",
|
|
"rd_design_output_list",
|
|
"rd_prototype_photos",
|
|
"rd_design_vv",
|
|
"rd_shelf_life",
|
|
"rd_lifetime",
|
|
"rd_biocompatibility",
|
|
"rd_cleaning",
|
|
"rd_emc_safety",
|
|
"rd_risk_report_v",
|
|
"rd_sw_release",
|
|
"rd_sw_unit_test",
|
|
"rd_sw_sys_test",
|
|
"rd_qualified_suppliers",
|
|
"rd_dmr_list",
|
|
"rd_pack_ship",
|
|
"rd_risk_report_t",
|
|
"rd_validation_plan",
|
|
"rd_use_error",
|
|
"rd_animal_study",
|
|
"rd_sw_quality",
|
|
"rd_clinical",
|
|
"rd_risk_report_val",
|
|
"rd_user_test",
|
|
"rd_design_validation_report",
|
|
}
|
|
|
|
func TestRDevTemplateDepthLint(t *testing.T) {
|
|
_, thisFile, _, _ := runtime.Caller(0)
|
|
repoRoot := filepath.Clean(filepath.Join(filepath.Dir(thisFile), "../.."))
|
|
templatesDir := filepath.Join(repoRoot, "templates", "docs")
|
|
|
|
for _, key := range rdevTemplateDepthAllowlist {
|
|
path := filepath.Join(templatesDir, key+".md")
|
|
b, err := os.ReadFile(path)
|
|
if err != nil {
|
|
t.Fatalf("%s: read: %v", key, err)
|
|
}
|
|
body := string(b)
|
|
if strings.Contains(body, "按本阶段专业结构写") {
|
|
t.Errorf("%s: still contains generic placeholder 「按本阶段专业结构写」", key)
|
|
}
|
|
headingCount := 0
|
|
for _, line := range strings.Split(body, "\n") {
|
|
if strings.HasPrefix(line, "## ") {
|
|
headingCount++
|
|
}
|
|
}
|
|
if headingCount < 4 {
|
|
t.Errorf("%s: want >=4 ## headings, got %d", key, headingCount)
|
|
}
|
|
if !strings.Contains(body, "| RD-") {
|
|
t.Errorf("%s: missing traceability row with | RD-", key)
|
|
}
|
|
if !strings.Contains(body, "## 待确认清单") {
|
|
t.Errorf("%s: missing ## 待确认清单", key)
|
|
}
|
|
if !strings.Contains(body, "## 签署") {
|
|
t.Errorf("%s: missing ## 签署", key)
|
|
}
|
|
}
|
|
}
|