当前位置:网站首页>Code Inspection for DevOps
Code Inspection for DevOps
2022-08-02 20:33:00 【InfoQ】
什么是代码检查
Why want to do code review
- 可读性:The code is not just to the machine understanding,也是给人看的.To be able to make the team everyone can easily read and understand the code.
- 可维护性:When maintenance and test the quality of the code easier to、Safety and save time,And not easy to out of the question.
- Reduce the technical debt:High quality code design good,Technical debt less,Developers do not need to spend a lot of time to repair problems and refactoring the code,因此,Can quicken the pace of the software development.The new team members are easy to understand code,It is easier to join the project.
Code review practice
本地检查
- According to the principle of check the pre,The timing of the local inspection is the most appropriate,Find and fix problems cost is the lowest;
- 因为是在本地执行,Perform check the efficiency of the fastest.
- Developers need to have high consciousness.
- IDE 插件:SonarLint、FindBugs、CheckStyle、PMD、Ali specification etc,You can check code coding style,坏味道,漏洞等.
- 本地构建:maven 编译、gradle 编译,You can check code grammar problem,Whether can be compiled.
- 本地测试:单元测试,Can check code logic problems.
本地提交检查
- Check the timing of the moderate;
- Check the high efficiency;
- 基于 Git 的 Hook 机制,在每次提交时运行 Hook,Automatic identification code of the simple question,Code reviewers focus on logic and system structure,Avoid because of trivial problem style and a waste of time.
- Local commits to the required high speed,Only static checking to save time,Such as code style;
- 客户端的 Hook,Because it is in local developers,Did not achieve full“强制”检查;
- Also relies on the developer's consciousness.
远程提交检查
- Can be relatively deep dynamic check,比如漏洞、Bug,It is better to check the;
- Can do the compulsory inspection,Ensure that anyone to submit code are of high quality;
- Code submitted did not directly submitted to the code base,Add artificial review link,Check code for business logic and architecture design more complex problems, such as;
- 可以控制每次提交的代码质量.
- The timing of the check on the,反馈周期较长;
- Need to set up the code check the server;
- 维护成本较高;
- 每次提交都检查,Will slow down the team's development pace.
Branch merge check
- Each time the inspection branch and fashionable,Can control and in other branches of code quality,Does not affect the development rhythm;
- Branches usually indicates a function at the time of merger and problems developed,There can be a relatively ample time to perform more deep dynamic check,比如漏洞,Bug 等;
- You can set the mandatory inspection,Ensure us into branch code is of high quality;
- 可以做 Code Review,Who review one-time review the function of the complete code(Don't recommend branch for a long time,大功能开发);
- 代码托管平台支持,如 GitHub、GitLab.
- The timing of the check on the,反馈周期较长.
Common inspection tools and practice
代码检查
人工评审
自动化测试
总结
边栏推荐
猜你喜欢
Security First: Tools You Need to Know to Implement DevSecOps Best Practices
IReport常见问题及处理方法
Flink Learning 9: Configure the idea to develop the flink-Scala program environment
红队实战靶场ATT&CK(一)
Playing in the cloud | The key technology of Tianyi cloud object storage ZOS high availability is revealed
小程序毕设作品之微信体育馆预约小程序毕业设计成品(6)开题答辩PPT
Wechat Gymnasium Appointment Mini Program Graduation Design Finished Works (7) Mid-term Inspection Report
erp系统和wms系统有什么区别
Cpolar application example of data acquisition equipment
在线文档Sheet技术解析
随机推荐
二叉查找树的查找
如何确保智能工厂的安全?
无法超越的100米_百兆以太网传输距离_网线有哪几种?
POE交换机全方位解读(下)
究极异常处理逻辑——多层次异常的处理顺序
透过案例看清API接口的作用——演示1688商品详情接口
DevOps之代码检查
redis总结_分布式缓存
阿波罗 planning代码-modules\planning\lattice\trajectory_generation\PiecewiseBrakingTrajectoryGenerator类详解
Security First: Tools You Need to Know to Implement DevSecOps Best Practices
54.【system系统互动函数大总结】
cpolar应用实例之多设备数据采集
故障分析 | 一条 SELECT 语句跑崩了 MySQL ,怎么回事?
小程序毕设作品之微信体育馆预约小程序毕业设计成品(8)毕业设计论文模板
搭建属于自己的知识库(Wikijs)
今年上半年,我国公路建设总体形势持续向好
深圳地铁16号线二期进入盾构施工阶段,首台盾构机顺利始发
shell中awk命令的if条件语句引入外置变量
多聚体/壳聚糖修饰白蛋白纳米球/mPEG-HSA聚乙二醇人血清白蛋白纳米球的制备与研究
STL案例-招聘新员工