{"type":"doc","content":[{"type":"heading","attrs":{"id":"4da4b82f-2cf8-488e-945b-8b616ab036fe","textAlign":"inherit","indent":0,"level":1,"isHoverDragHandle":false},"content":[{"type":"text","text":"一、治理背景"}]},{"type":"paragraph","attrs":{"id":"66ea7015-01b9-4f7c-9a28-54acb880961c","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"随着公司业务的快速发展,前端平台作为研发职能部门,在高效支撑业务迭代的同时,前端新建的应用不断增加,截止到2023年5月在Uraya平台统计的各业务域的应用(B端+C端)总数已经达到170多个,发布流程中出现问题的风险逐步显现,稳定性问题逐步突出。为了更好的维护应用的代码,解决潜在的稳定性问题风险,2023年6月做了前端大仓的技术调研并在7月开始试行前端大仓的研发模式,在2024年年初开始对前端大仓应用的稳定性进行体系化治理,近2年时间的治理,前端大仓的应用无论在代码质量还是流程统一上都达到了一定的稳定程度,应用稳定性的治理达到了不错的效果,从未出现因大仓稳定性治理导致的线上问题。"}]},{"type":"paragraph","attrs":{"id":"1ed17ecf-d35a-401a-8a00-90c1d1da85b3","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"27503081-ad19-4de7-a093-14b16ab30097","textAlign":"inherit","indent":0,"level":1,"isHoverDragHandle":false},"content":[{"type":"text","text":"二、治理体系"}]},{"type":"paragraph","attrs":{"id":"958e3e07-82e4-41a3-bbd5-9d825cc544d3","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"前端大仓在试行之后,经过在迭代的持续性治理,已经形成了一套完整的稳定性治理流程体系,如下:"}]},{"type":"image","attrs":{"id":"4afd4f89-8964-4958-ae2a-0b0bb9c6e21d","src":"https://developer.qcloudimg.com/http-save/audit-9927536/0fa82e16f010ed65bcc57ea4bfd2411b.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"bulletList","attrs":{"id":"806698be-3132-482f-a769-9111fd0e3094","isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"d5cdcb6c-20d2-41d3-a41e-daf8b95abe55"},"content":[{"type":"paragraph","attrs":{"id":"47afb244-ab6c-40f4-8216-a94a7a9f75a7","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"定义指标:"},{"type":"text","text":"在前端大仓monorepo研发流程模式下定义应用稳定性治理目标,治理目标是经过各业务域统一对焦且切实有效的;"}]}]},{"type":"listItem","attrs":{"id":"016b001b-75c4-4f66-8c3d-3af461570934"},"content":[{"type":"paragraph","attrs":{"id":"d4179816-60c8-4bd3-8c4c-647eff3e1593","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"治理目标制定:"},{"type":"text","text":"在每个季度初,各业务域根据应用稳定性治理结果重新定义治理目标,写入到OKR中,作为当前季度的稳定性治理事项,各业务域因应用的质量不一样,稳定性治理指标也存在一定的区别;"}]}]},{"type":"listItem","attrs":{"id":"d8481d7b-c416-4bd2-bfb0-175eb71d9951"},"content":[{"type":"paragraph","attrs":{"id":"94b0fc3f-2dce-479a-80fb-a77db6cbf777","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"跟进过程:"},{"type":"text","text":"在每双周的平台周会同步各业务域在迭代的稳定性治理结果,对于治理效果不太理想的业务域做适当的提醒,跟进每个迭代的治理情况;"}]}]},{"type":"listItem","attrs":{"id":"8cc6e225-7ca1-449a-b34f-a495c22d0b98"},"content":[{"type":"paragraph","attrs":{"id":"204b71e2-5b90-42a8-9eda-4c6bd5ba290c","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"治理结果复盘:"},{"type":"text","text":"在每个季度末,OKR复盘的时候,会统计各业务域在当前季度的治理结果,通过KR目标来衡量是否达成稳定性治理目标。"}]},{"type":"paragraph","attrs":{"id":"a55dbede-67bb-4d16-97a9-d8237607e4f2","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}}]}]},{"type":"paragraph","attrs":{"id":"628ebde8-f7a8-4f95-a803-538f6863e701","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"通过"},{"type":"text","marks":[{"type":"bold"}],"text":"定义指标 -> 治理目标制定 -> 跟进过程 -> 治理结果复盘"},{"type":"text","text":"不断的迭代循环治理,形成一个闭环,且各业务域也在不断的调整治理目标,直到最终达成平台的治理目标,使得大仓各应用的稳定性的治理都能达到不错的效果。"}]},{"type":"paragraph","attrs":{"id":"60aecef3-d884-4c4f-a7b3-7d5087e4da7d","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"7a61dbee-24fb-4a1d-b628-3c5214f0b6fb","textAlign":"inherit","indent":0,"level":1,"isHoverDragHandle":false},"content":[{"type":"text","text":"三、治理指标"}]},{"type":"paragraph","attrs":{"id":"d7dc9448-c818-4640-885a-893c299ae345","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"截止目前,前端大仓的"},{"type":"text","marks":[{"type":"bold"}],"text":"应用已达200多个,代码行数已经达到550多万行,"},{"type":"text","text":"如何提升如此体量的代码质量和应用稳定性是一个相对比较有挑战的事情。经过早期半年的试行,基于大仓代码标准化以及研发流程标准化的建设,逐步形成了5大可衡量的治理指标:Git元数据的大小、代码质量分、研发流程卡点、Lint error质量分、应用代码重复率,如下:"}]},{"type":"bulletList","attrs":{"id":"68bdf7ec-3ecf-413a-861b-a04f6c412a93","isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"32ef6942-3aa2-4425-a1c6-367eed179f96"},"content":[{"type":"paragraph","attrs":{"id":"5e803346-f1a3-416a-8a5c-de5f852f2c6a","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"Git元数据的大小:"},{"type":"text","text":"随着每个迭代各业务域代码行数的增加以及git记录的提交,大仓的Git元数据会不断增加,当增加到一定程度的时候,会对本地git命令操作、MR变更以及代码的回合产生影响,进而影响应用发布的稳定性。对Git元数据大小进行治理,能够直接提升研发效率以及应用发布的稳定性;"}]}]},{"type":"listItem","attrs":{"id":"9783c0dc-d277-438b-b281-7573e7af2d17"},"content":[{"type":"paragraph","attrs":{"id":"edb68a8a-fbec-4a91-9579-73366d97f16c","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"代码质量分:"},{"type":"text","text":"对应用代码的质量通过不同的可衡量指标进行积分汇总成代码质量分,主要包括大文件、函数复杂度、HTTPS检测、敏感词检测、安全检测、前端运算和魔数这些指标得分来体现应用代码的质量。这些指标治理得好,代码质量分就越高,应用的稳定性也就越好;"}]}]},{"type":"listItem","attrs":{"id":"075da232-a0b7-48d1-bd59-19ee616d006c"},"content":[{"type":"paragraph","attrs":{"id":"480e1a1e-8c00-4538-bf17-c905fa6329b9","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"Lint error质量分:"},{"type":"text","text":"Lint error是前端代码标准规范的重要衡量指标,在大仓下的应用代码有统一的lint检测规范。对研发每次提交的代码进行Lint规范检测,获取不同的质量分,通过不同的分数区间来衡量Lint error质量分,质量分越高,应用的代码规范越好,应用的稳定性也就越好;"}]}]},{"type":"listItem","attrs":{"id":"dba21eb9-6f34-4dfb-937f-dc2ad60ec3ce"},"content":[{"type":"paragraph","attrs":{"id":"4168ef70-1c28-46a1-b2c8-09984c8b3575","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"研发流程卡点:"},{"type":"text","text":"在应用代码MR阶段和构建发布流程中,研发流程卡点至关重要,主要包括强卡和弱卡。比如对lint标准规范的检测、变更文件权限校验、分支名称检测及合法性校验等进行卡点,当出现卡点的时候,通过强卡和弱卡的手段来提示研发问题的风险,避免了一些不规范操作带来的线上问题,提升了应用构建发布的稳定性;"}]}]},{"type":"listItem","attrs":{"id":"260688a3-63fc-424f-a851-44d7d403b1e0"},"content":[{"type":"paragraph","attrs":{"id":"f7d36996-e88f-405b-84a0-13d20967edd8","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","marks":[{"type":"bold"}],"text":"应用代码重复率:"},{"type":"text","text":"代码重复率是体现大仓应用代码可复用的重要衡量指标,代码的复用性越好,代码的重复率就越低,可复用的代码就越稳定,进而提升应用代码的稳定性。"}]},{"type":"paragraph","attrs":{"id":"6746bbd0-d552-49c1-bbee-bbb5c2ba2739","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}}]}]},{"type":"paragraph","attrs":{"id":"6bf924f7-ed70-4a73-9507-d645bcd9492e","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"大仓应用的稳定性基本上都是围绕上面5个指标来进行治理的,在逐步推进治理的过程中,大仓应用的代码稳定性也在不断的提升,当达到一定程度的时候,各应用的稳定性也会达到一定的程度趋于平稳。"}]},{"type":"paragraph","attrs":{"id":"20f1d4c6-16db-4388-a97e-dfd4542c9427","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"0807f3be-53bf-4197-99b6-0af2416f0b24","textAlign":"inherit","indent":0,"level":1,"isHoverDragHandle":false},"content":[{"type":"text","text":"四、治理成效"}]},{"type":"paragraph","attrs":{"id":"d9db9790-a5af-4c72-a9b4-ef5299df4fce","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"基于大仓代码的标准规范以及统一的研发发布流程,且在每个季度持续推进治理下,各业务域的治理指标都有显著的提升,进而提升了前端平台大仓应用整体的稳定性。具体成效如下:"}]},{"type":"bulletList","attrs":{"id":"2a3031ac-8248-4d70-8417-78e0098b26e4","isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"cd5f700a-3515-4abc-8f2d-4d891fc533fc"},"content":[{"type":"paragraph","attrs":{"id":"765fb6e2-9eb3-4c7c-b1e0-353377b1c994","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"自从前端大仓试行以来,依托统一的研发构建发布流程,"},{"type":"text","marks":[{"type":"bold"}],"text":"大仓应用从未出现过线上冒烟点和故障;"}]}]},{"type":"listItem","attrs":{"id":"d12a8a31-2289-47ba-b5d1-2bb0c4863112"},"content":[{"type":"paragraph","attrs":{"id":"708545fe-c91f-4430-a480-1f6a6b685351","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"通过对Git元数据的大小进行性能优化,"},{"type":"text","marks":[{"type":"bold"}],"text":"将原来大仓800M+的元数据大小减少到平均各业务域Git元数据大小60M以下,"},{"type":"text","text":"提升了本地Git命令操作的效率,使得MR变更和代码回合更加的清晰,提升了应用发布流程的稳定性;"}]}]},{"type":"listItem","attrs":{"id":"4100fe62-5a57-4fd7-b609-6bcba5d52944"},"content":[{"type":"paragraph","attrs":{"id":"78718f64-357a-461c-a01f-31738cbb87bf","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"大仓应用代码的质量分"},{"type":"text","marks":[{"type":"bold"}],"text":"从最初的74分左右提升到目前的85分以上,"},{"type":"text","text":"极大的提升了应用代码的质量,提升了应用线上功能的稳定性;"}]}]},{"type":"listItem","attrs":{"id":"2b78a738-a53d-45e3-bf58-a33e4225e69f"},"content":[{"type":"paragraph","attrs":{"id":"63fe6361-e29a-4270-afd1-3fa64b9ba963","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Lint error的质量分"},{"type":"text","marks":[{"type":"bold"}],"text":"从最初的平均10分左右提升到目前的13分以上,"},{"type":"text","text":"促进了各业务域应用代码标准规范的统一,不仅提升了大仓应用代码的质量和稳定性,还提升了平台轮岗、借调研发的编码效率;"}]}]},{"type":"listItem","attrs":{"id":"0c8706e9-ed7d-4ede-8d36-afa9adfa238f"},"content":[{"type":"paragraph","attrs":{"id":"2e2686c4-599f-449b-8c3c-e09e07003ff2","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"研发流程卡点在构建发布和MR阶段上线以后,截止到目前为止,"},{"type":"text","marks":[{"type":"bold"}],"text":"强卡次数1200多次,弱卡次数2万多次,成功避免出现线上问题隐患130次左右,"},{"type":"text","text":"提升了应用发布的稳定性;"}]}]},{"type":"listItem","attrs":{"id":"a65acf51-89e2-416e-a911-2485727805c0"},"content":[{"type":"paragraph","attrs":{"id":"823834ed-19cd-47de-8e8b-f1635f8ea24b","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"代码重复率"},{"type":"text","marks":[{"type":"bold"}],"text":"从最初的12.5%左右降低到目前的8%以下,"},{"type":"text","text":"在提升代码复用的同时,也提升了整体大仓应用代码的可维护性和稳定性。"}]}]}]},{"type":"paragraph","attrs":{"id":"9f275fb3-cac0-48eb-be5a-3bb62bedbc61","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"929a3d89-f18e-4e79-9841-ca7d0d35d914","textAlign":"inherit","indent":0,"level":1,"isHoverDragHandle":false},"content":[{"type":"text","text":"五、治理事项"}]},{"type":"heading","attrs":{"id":"548f4ad6-8677-47f2-961e-52c6b513d45d","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"Git元数据性能优化"}]},{"type":"paragraph","attrs":{"id":"75bdca0d-4ca8-4e47-a3a8-9e4b547a580f","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"前端大仓自试行之后,Git元数据就在持续的递增,截止到2024年年底,Git元数据的大小已经接近1G,本地的部分Git命令执行时间超过5秒,MR变更及代码回合经常被非当前业务变更的文件困扰,影响了大仓应用发布的稳定性。为了解决这些性能问题,对Git元数据的大小做了性能优化,主要事项包括:"}]},{"type":"image","attrs":{"id":"9fd3f02f-0071-4cde-a623-99ec9f6ecfb9","src":"https://developer.qcloudimg.com/http-save/audit-9927536/5fc5d1ab1c45ec695d949feb868f26ea.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"bulletList","attrs":{"id":"158e9ebf-9bf0-4696-8ed2-3348425a1e78","isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"0b4133a1-f7b8-403c-99bc-d3497347be7e"},"content":[{"type":"paragraph","attrs":{"id":"4fd3cd0d-0c8d-46d5-bc1c-4c5c3213db67","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"对Git clone命令做了二次封装,利用其实现本地缓存,二次clone时间至少减少90%左右的时间;"}]}]},{"type":"listItem","attrs":{"id":"40a32bdc-ec86-4a88-8316-fdb7edbcf9ec"},"content":[{"type":"paragraph","attrs":{"id":"8565fb99-6738-467c-bd03-f7b24ca8714c","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"利用Git sparse-checkout稀疏检出的能力,将原来首次几分钟的clone时间减少到10秒以内;"}]}]},{"type":"listItem","attrs":{"id":"e14cc028-431c-403a-a6aa-c80ed148e58f"},"content":[{"type":"paragraph","attrs":{"id":"a7660278-9157-452c-9ae4-5a815d434724","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"通过动态化技术拆分大仓的元数据,将原来近1G的元数据减少至平均单个业务域60M以下。"}]},{"type":"paragraph","attrs":{"id":"d1c8caf6-4f54-42b9-abc6-190c7e7c75a4","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}}]}]},{"type":"paragraph","attrs":{"id":"9d0e15f0-dae4-492d-bfce-984b698b0e67","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"通过上面的技术实现,彻底解决了Git元数据持续递增的性能问题,使得MR阶段的代码CR更加的清晰,避免了因过多代码提交记录带来的CR不清晰、回合代码不清晰导致出现线上问题的风险,提升了应用发布的稳定性。"}]},{"type":"heading","attrs":{"id":"64b975bb-f04f-409b-8564-4f59faaa3c10","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"代码质量分的统计"}]},{"type":"paragraph","attrs":{"id":"1cf6c44e-71b2-4b36-8bf5-94a0d067a14e","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"应用代码质量分是衡量应用代码质量的重要指标,其中主要包含大文件、函数复杂度、HTTPS检测、敏感词检测、安全检测、前端运算和魔数这些指标得分来体现应用代码的质量,基于Uraya平台的规则统计逻辑,每个迭代都会对应用的代码进行扫描并做质量分的统计,如下:"}]},{"type":"image","attrs":{"id":"27a51edb-3c3a-4341-99c7-50aa4f0d89f4","src":"https://developer.qcloudimg.com/http-save/audit-9927536/be75677ff9b2dd35acd62f7722eb386d.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"9fd02afb-4f2a-47c1-90ba-400ae1fc63a0","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"同时也可以查看应用质量分各维度指标的得分情况,具体详情信息如下:"}]},{"type":"image","attrs":{"id":"2d1673a1-9ea0-465e-9688-7cba52b45610","src":"https://developer.qcloudimg.com/http-save/audit-9927536/ac1fb985498afef233a28cd4a5718002.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"4d587e57-8432-42eb-b1c4-5b2c7aa9670f","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"每个季度初期会根据不同业务域应用的质量情况来制定当前季度可达成的质量分目标,并且在季度末以此目标来最终复盘应用质量分的治理情况,如下是2025年Q3季度的整体质量分治理情况:"}]},{"type":"image","attrs":{"id":"49f79894-011f-4536-b25d-3ef11c4158a2","src":"https://developer.qcloudimg.com/http-save/audit-9927536/4d1d335104b19d932f41eaa85a143f2f.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"ca560b02-0f8a-4caa-8895-30176c378c80","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"应用质量分的治理有一个标准线,高于80分的应用说明代码质量已经比较好了,后续再投入时间治理的话,ROI不高,故应用质量分超过80分的业务域常态化治理即可,不用专门花时间去做治理。在Q3结束之后,前端平台所有的业务域基本都达成了80分的标准线。"}]},{"type":"heading","attrs":{"id":"5bb1c050-c604-403c-b77f-d05499c8e61f","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"Lint标准规范的统一"}]},{"type":"paragraph","attrs":{"id":"294fa2b6-2e1d-4f42-b46c-02b2349b4abb","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"目前前端大仓已经集成了上百个应用,很多应用都有各自的Lint规则配置以及代码规范配置,特别是在早期基于样板间创建的应用,这个现象尤为明显。在大仓里面,如果每个应用还是按照各自的规范去开发的话,那么当研发轮岗或者各域之间互相借调的时候,因代码风格的不一致带来的熟悉上手成本、IDE规则配置成本等这些都会比较高,且研发效率低下,这跟之前单个应用仓库开发没什么区别。因此对大仓下所有应用的代码规范做了统一,研发编写的代码都需要符合标准规范,这样不仅提升了应用代码的稳定性,也提升了平台轮岗、借调研发的编码效率。主要的代码标准规范如下:"}]},{"type":"bulletList","attrs":{"id":"12c1f243-8b90-4b02-a754-b63ee761228e","isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"7bcf9475-e026-4e08-8f72-a3a860b16276"},"content":[{"type":"paragraph","attrs":{"id":"e142d387-bc60-4ad6-86e0-6cdbeaa5e05f","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"TS标准规范(TypeScript语言):@xxxxx/ts-config/base.json"}]}]},{"type":"listItem","attrs":{"id":"52691052-a9a4-48ce-801d-154b8d11248e"},"content":[{"type":"paragraph","attrs":{"id":"3a28797e-ea56-4f16-9c9b-23cddb9aaee2","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"eslint标准规范(JavaScript语言):@xxxxx/eslint-config"}]}]},{"type":"listItem","attrs":{"id":"6d60010c-e679-4225-aef0-2d63e3de8356"},"content":[{"type":"paragraph","attrs":{"id":"12713faf-84fb-416b-8023-9ecb2ba30ddf","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"stylelint标准规范(CSS样式):@xxxxx/stylelint-config"}]}]},{"type":"listItem","attrs":{"id":"33725f43-8fbe-42fb-85c6-7c5053e84385"},"content":[{"type":"paragraph","attrs":{"id":"409d0bba-a5ce-4cf9-9720-886a262322e6","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":".prettierrc标准规范(代码格式化)& VSCode编辑器代码格式化配置"}]},{"type":"paragraph","attrs":{"id":"5aa3ba05-046a-4faf-9db7-69cdd002657a","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}}]}]},{"type":"paragraph","attrs":{"id":"db256f42-4d30-4335-96e7-cc217dcc3b3f","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"在大仓中有顶层目录的基本规范、应用目录下的代码规范以及不同技术栈的代码规范,其关系如下:"}]},{"type":"image","attrs":{"id":"3c20c49e-a1f4-4186-b269-d902f85815d6","src":"https://developer.qcloudimg.com/http-save/audit-9927536/4a4267f9d9cf3fbe61f903bb62be14d3.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"83dc8f18-a9ab-4e8b-8592-6307fdcd099c","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"在研发本地提交代码的时候,会触发git钩子函数对变更文件的代码进行校验,确保提交的代码是符合标准规范的,并且对Lint error质量分定义了治理分记分规则,总分16.12分,代码提交的error错误数各区间得分如下:"}]},{"type":"bulletList","attrs":{"id":"b1f69684-e98b-4077-8753-f6dc78d448ec","isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"ae0dbf6c-707e-40d9-aacd-4920076581e8"},"content":[{"type":"paragraph","attrs":{"id":"83c4fb43-9e72-433e-b557-3f587734d5eb","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"0~100(包含100)个error错误: 得4.12分"}]}]},{"type":"listItem","attrs":{"id":"eb3fe324-9007-4d30-b370-e0b95db4648b"},"content":[{"type":"paragraph","attrs":{"id":"a27be1b4-6641-4484-8d22-cf7c6e805a77","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"100~300(包含300)个error错误:得2.8分"}]}]},{"type":"listItem","attrs":{"id":"9f1914b6-f7e0-49e5-9311-dca0a838872a"},"content":[{"type":"paragraph","attrs":{"id":"8933488f-0c13-4d85-835e-559216b9c17a","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"300~600(包含600)个error错误:得2.8分"}]}]},{"type":"listItem","attrs":{"id":"ddce9e73-6204-4419-9a0f-c068332c845b"},"content":[{"type":"paragraph","attrs":{"id":"12d8a2e9-522e-4ddd-9ac0-4a66fd91f1d1","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"600~800(包含800)个error错误:得1.2分"}]}]},{"type":"listItem","attrs":{"id":"eb7481f2-4f0b-4b6c-837d-c3b4cdcd52d1"},"content":[{"type":"paragraph","attrs":{"id":"f00ad33b-badf-467f-848d-20e66c36aac1","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"800~1000(包含1000)个error错误:得4分"}]}]},{"type":"listItem","attrs":{"id":"2f57299c-268b-4742-a448-e4255fc55229"},"content":[{"type":"paragraph","attrs":{"id":"9532116e-76e1-4bb8-b4b7-7f80b41a71cd","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"1000-2000 (包含2000)个error错误:得1.2分"}]}]},{"type":"listItem","attrs":{"id":"98f4872a-6cff-407c-a34f-012305cf736d"},"content":[{"type":"paragraph","attrs":{"id":"1ae59be4-6ec8-462d-8f6a-414b7a25f76a","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"2000个以上error错误:得0分"}]}]}]},{"type":"paragraph","attrs":{"id":"e98db997-36c3-4bff-88aa-325e4eb8ea58","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"在每双周的平台周会上进行治理情况的同步,同时在季度末复盘当前季度的整体达成情况,如下是2025年Q3季度各业务域的lint质量分治理情况:"}]},{"type":"image","attrs":{"id":"37b6e5fd-85f1-46c5-8916-234e119f7055","src":"https://developer.qcloudimg.com/http-save/audit-9927536/9ec023302bd593dbfe715606e256fbca.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"700e57f0-8a29-4f9c-859b-21a5b14a58a2","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"Lint error质量分的治理也有一个标准线,高于9分的应用说明代码标准规范已经比较好了,再专门投入时间治理的话,ROI不高,故应用的Lint error质量分超过9分的业务域都是常态化治理即可。在Q3结束的时候,前端平台所有的业务域都达成了9分的标准线。"}]},{"type":"heading","attrs":{"id":"442f02a3-687c-4cec-925f-aa796ac9a838","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"研发流程卡点的建设"}]},{"type":"paragraph","attrs":{"id":"8c867e0f-1c78-4277-8d66-c3fb0d2edc10","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"为了避免研发本地的一些不规范流程操作带来的线上稳定性问题,在应用测试环境的构建发布流程新增流程卡点,如下所示:"}]},{"type":"image","attrs":{"id":"5100289b-69e2-4f86-b7d0-963468aeae53","src":"https://developer.qcloudimg.com/http-save/audit-9927536/c30a830dad80ace808ee860a5cafd1e6.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"image","attrs":{"id":"6159f707-887a-428f-bd8e-84040184b107","src":"https://developer.qcloudimg.com/http-save/audit-9927536/8a14fed0e3fe231ff1817af8c3902c5e.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"cab6259d-ea3b-4382-9912-622c4d53a1fc","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"同时在构建发布流程中保留研发流程卡点的情况下,在MR阶段也新增了质量分的卡点,只要检测出有强卡的情况下,就不允许合并到release分支,确保了合入代码的质量和标准规范,如下图所示:"}]},{"type":"image","attrs":{"id":"36054061-9ac5-422a-9440-5b6fe32091ae","src":"https://developer.qcloudimg.com/http-save/audit-9927536/66c41fb63b61c47622876e00b71029c4.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"image","attrs":{"id":"0bdd3f1c-fe6e-43c6-98e5-a71f21a0369a","src":"https://developer.qcloudimg.com/http-save/audit-9927536/3753154128eb36a5abf413d223b853da.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"be0a14f6-3421-41c1-864d-afaf42278689","textAlign":"center","indent":0,"color":null,"background":null,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"967cca4a-611f-44d3-8404-7f9400b231fe","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"基于大仓应用的研发流程,主要有以下流程卡点:"}]},{"type":"bulletList","attrs":{"id":"30c5dab4-4684-4d0b-af23-f749d4d28071","isHoverDragHandle":false},"content":[{"type":"listItem","attrs":{"id":"43a9c0ba-b0b4-4b29-91c9-581585289304"},"content":[{"type":"paragraph","attrs":{"id":"aef9d26f-1593-48d4-8409-0aaf1e302cea","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"【弱卡】分支名称检测及合法性校验"}]}]},{"type":"listItem","attrs":{"id":"b8ccdfb9-13d8-40f1-8f67-b77dca5b80e3"},"content":[{"type":"paragraph","attrs":{"id":"dab0d0bf-5f44-41aa-8b8a-15ea8c904622","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"【弱卡】Lint标准规范检测"}]}]},{"type":"listItem","attrs":{"id":"51b282bb-20b8-483c-bc06-889d37dd3ac4"},"content":[{"type":"paragraph","attrs":{"id":"acc6e43c-89a1-4aa3-950b-79e3753602c1","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"【强卡】变更文件权限校验"}]}]},{"type":"listItem","attrs":{"id":"941e2346-14c9-491c-9432-80420c63b83b"},"content":[{"type":"paragraph","attrs":{"id":"d69c2087-866e-4829-90de-b3b6a33ab2d1","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"【强卡】分支变更与对应应用是否匹配"}]}]},{"type":"listItem","attrs":{"id":"4bb18e75-bb85-48de-980f-431df514c2ee"},"content":[{"type":"paragraph","attrs":{"id":"3a157c4a-8b8e-4f23-951f-675b130b1236","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"【强卡】分支变更是否存在多个业务域或者多个应用的修改"}]}]},{"type":"listItem","attrs":{"id":"906d4822-2d73-4060-9677-0e451599bce4"},"content":[{"type":"paragraph","attrs":{"id":"433f106d-06b3-4db1-984a-e105ade07bd8","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"【强卡】分支变更是否存在不允许修改的文件夹"}]},{"type":"paragraph","attrs":{"id":"0749ce15-700a-450a-b446-b92487607efb","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}}]}]},{"type":"paragraph","attrs":{"id":"e4f51b69-e3bd-4e3d-be55-d48cebc5aec2","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"通过研发流程的强卡和弱卡进一步规范研发流程的操作,截止到目前为止,强卡次数1200多次,弱卡次数2万多次,成功避免出现线上问题隐患130次左右,提升了应用发布的稳定性。"}]},{"type":"heading","attrs":{"id":"ddcaf91a-6f6b-47f5-a1f0-b4d9c2dee1ef","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"代码重复率的统计"}]},{"type":"paragraph","attrs":{"id":"a4368ba1-7c03-4e66-bcca-e77c4c577b3c","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"代码重复率是衡量大仓代码可复用的重要指标,也是平台侧一直推进的治理事项,前期代码重复率的统计都依赖于研发本地跑脚本看数据,每个迭代结束才清楚治理效果。为了便于研发在本地能够实时的查看代码质量分的治理结果,提供了VSCode插件来实时统计结果,如下功能所示:"}]},{"type":"image","attrs":{"id":"4bb9f626-cc4c-4df8-87a0-b418e8a5e9d5","src":"https://developer.qcloudimg.com/http-save/audit-9927536/4e730c8ff5c49f0d758bbbf48de5467c.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"f641355a-c85c-41e9-95fe-ac8f3a19bd09","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"研发通过点击上面的治理小助手,就能实时查看当前分支的治理效果,极大的提升了治理效率。同样在每双周也会进行代码重复率的同步,在季度末会进行治理目标的复盘,如下是2025年Q3季度各业务域的代码重复率治理情况:"}]},{"type":"image","attrs":{"id":"7e086f66-336d-4a59-b430-5fd9f8e64850","src":"https://developer.qcloudimg.com/http-save/audit-9927536/13e10323eeb2530ced030f06cec6bd43.png","extension":"","align":"center","alt":"","showAlt":false,"href":"","boxShadow":"","width":"","aspectRatio":0,"status":"success","showText":true,"isPercentage":false,"percentage":0,"isHoverDragHandle":false}},{"type":"paragraph","attrs":{"id":"14850081-328e-44ae-a0cc-576683376683","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"代码重复率的治理也有一个标准线,低于6%的应用说明代码复用已经比较好了,再专门投入时间治理的话,ROI不高,故应用的代码重复率低于6%的业务域都是常态化治理即可。在Q3结束的时候,前端平台部分业务域已经达成了低于6%的标准线。"}]},{"type":"paragraph","attrs":{"id":"25fbe0de-6f1c-4b0b-823a-c0b7ccfb23c2","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"1d3be286-de55-4091-b843-c6cb06adb391","textAlign":"inherit","indent":0,"level":1,"isHoverDragHandle":false},"content":[{"type":"text","text":"六、治理总结"}]},{"type":"paragraph","attrs":{"id":"a1890d59-836c-4dda-9913-5b8fc36d4bc2","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"前端平台通过试行大仓的研发模式,系统性地开展了应用的稳定性治理工作。自2023年7月试行、2024年初体系化推进以来,围绕五大核心指标--Git元数据大小、代码质量分、Linterror质量分、研发流程卡点和代码重复率,构建了“定义指标→制定目标→过程跟进→结果复盘”的闭环治理体系。通过统一代码规范、优化Git元数据性能、强化流程发布卡点、提升代码复用等举措,显著提升了大仓应用整体的稳定性。截至2025年Q3,各业务域普遍达成质量标准线,"},{"type":"text","marks":[{"type":"bold"}],"text":"大仓应用从未发生因治理导致的线上故障,实现了高效、稳定、可持续的前端大仓应用研发稳定性治理体系。"},{"type":"text","text":"随着目前大模型的不断迭代,后续结合AI智能体对研发流程进行稳定性加固,相信大仓应用的稳定性会更上一个台阶。"}]},{"type":"paragraph","attrs":{"id":"a02e364f-6dc8-4189-9a98-0571dbbc1682","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"bbf164be-0963-491e-be7a-fc586f81430f","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"往期回顾"}]},{"type":"paragraph","attrs":{"id":"19aa7a39-539d-4371-af21-27916e3a7242","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"1.RocketMQ高性能揭秘:承载万亿级流量的架构奥秘|得物技术"}]},{"type":"paragraph","attrs":{"id":"9374c264-0870-4ffb-bc20-882c310f9036","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"2.PAG在得物社区S级活动的落地 "}]},{"type":"paragraph","attrs":{"id":"75d38e96-db8c-4bd3-958d-5190801e3339","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"3.Ant Design 6.0 尝鲜:上手现代化组件开发|得物技术"}]},{"type":"paragraph","attrs":{"id":"b14e2dda-71e6-4782-a0d0-b773607746fb","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"4.Java 设计模式:原理、框架应用与实战全解析|得物技术"}]},{"type":"paragraph","attrs":{"id":"bcffa775-bf34-4a0e-89c7-57e21acf9911","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"5.Go语言在高并发高可用系统中的实践与解决方案|得物技术"}]},{"type":"paragraph","attrs":{"id":"5804c245-86d3-4870-aa94-aeced132422e","textAlign":"inherit","indent":0,"color":null,"background":null,"isHoverDragHandle":false}},{"type":"heading","attrs":{"id":"8e76431e-53dd-44ee-a0c0-ac63348f6360","textAlign":"inherit","indent":0,"level":2,"isHoverDragHandle":false},"content":[{"type":"text","text":"文 /玉润"}]},{"type":"paragraph","attrs":{"id":"17690daa-dbe7-4202-9660-64edeab5a4f2","textAlign":"center","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"关注得物技术,每周更新技术干货"}]},{"type":"paragraph","attrs":{"id":"70c63907-9adc-4d82-8d9a-e3fc0697511f","textAlign":"center","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"要是觉得文章对你有帮助的话,欢迎评论转发点赞~"}]},{"type":"paragraph","attrs":{"id":"4448cdd3-4a81-4fe9-89c3-ffb947effff6","textAlign":"center","indent":0,"color":null,"background":null,"isHoverDragHandle":false},"content":[{"type":"text","text":"未经得物技术许可严禁转载,否则依法追究法律责任。"}]}]}