Code Review Checklist

更新时间:2023-06-25 10:05:05 阅读: 评论:0

以下是用于开发人员代码review Macadamian's指南 . 在代码提交控制前,它们应该按照以下的规则检查。
我们公开这份检查表是希望给任何开发部门的同行代码评审提供一个简要的参考。你可以直接按本表开始评审,当然,更好的办法是
按照开发实际作出修改后使用。
iproute目录
  General Code Smoke Test 通用测试
  Comments and Coding Conventions 盲剑客注释和代码风格
  Error Handling 错误处理
  Resource Leaks 资源泄漏
  Control Structures 控制结构
个人工作表现情况简述  Performance 性能
  Functions 函数
  Bug Fixes bug修复
  Math 数学
General Code Smoke Test 通用测试
Does the code build correctly?
性书法图片No errors should occur when building the source code. No warnings should be introduced by changes made to the code.
代码可以正确编译:编译代码时应无错误。
Does the code execute as expected?
When executed, the code does what it is suppod to.
代码是否像预期结果那样执行?
Do you understand the code you are reviewing?
As a reviewer, you should understand the code. If you don't, the review may not be complete, or the code may not be well commented.
你理解正在review(评审)的代码了吗?作为一个评审者,你应该理解这些代码;否则将导致评审不充分或效果不太好。
Has the developer tested the code?
Insure the developer has unit tested the code before nding it for review. All the limit cas should have been tested.
确保开发者本人已经测试过代码。在提交评审前,确保开发者已经完成了代码的单元测试。所有可能的情况应该测试。
Comments and Coding Conventions 注释和代码风格
Does the code respect the project coding conventions?
Check that the coding conventions have been followed. Variable naming, indentation, and bracket style should be ud.
代码是否遵循项目的编码风格?检查编码风格是否已经遵循,比如变量命名、缩排、括号风格等。
Does the source file start with an appropriate header and copyright information?
Each source file should start with an appropriate header and copyright information. All so
urce files should have a comment block describing the functionality provided by the file.
源代码文件已适当的头和版权信息开始。
Are variable declarations properly commented?
Comments are required for aspects of variables that the name doesn't describe. Each global variable should indicate its purpo and why it needs to be global.
变量声明是否有合适的注释。尤其是全局变量,需要注明声明为全局的目的以及缘由。
Are units of numeric data clearly stated?
Comment the units of numeric data. For example, if a number reprents length, indicate if it is in feet or meters.
数值数据块有否明确描述。比如,如果一个数字代表长度,应标明单位是英尺还是米。
Are all functions, methods and class documented?
Describe each routine, method, and class in one or two ntences at the top of its definiti86年属相
on. If you can't describe it in a short ntence or two, you may need to reasss its purpo. It might be a sign that the design needs to be improved.
所有的函数、方法和类都已正式描述。在定义程序、方法、类以前,用一两句简短的话描述它们。
如果不能在一两句话之内描述清楚,应该重新考虑它的目的;这也是需要改进设计的一个信号。
Are function parameters ud for input or output clearly identified as such?
Make it clear which parameters are ud for input and output.
所有函数的参数列表是否已经明确表示?
Are complex algorithms and code optimizations adequately commented?
Complex areas, algorithms, and code optimizations should be sufficiently commented, so other developers can understand the code and walk through it.
复杂算法和代码优化 需要足够的注释。以确保开发人员可以理解并审核。
Does code that has been commented out have an explanation?
There should be an explanation for any code that is commented out. "Dead Code" should be removed. If it is a temporary hack, it should be identified as such.
注释掉的代码是否有解释?"Dead Code" 必须删除。
Are comments ud to identify missing functionality or unresolved issues in the code?
A comment is required for all code not completely implemented. The comment should describe what's left to do or is missing. You should also u a distinctive marker that you can arch for later (For example: "TODO:francis"). 土豆发芽了还能吃
缺少的函数功能、没有完全解决的问题需要注释表示。注释要描述剩下的工作以及缺少的东西。最好加一个标记以便将来查找,例如“TODO:fancis”
Error Handling  错误处理
Are asrtions ud everywhere data is expected to have a valid value or range?
Asrtions make it easier to identify potential problems. For example, test if pointers or references are valid.酒店设计案例
在需要有效 值或范围 的任何地方使用断言。如指针和引用。
儿童攀岩Are errors properly handled each time a function returns?
An error should be detected and handled if it affects the execution of the rest of a routine. For example, if a resource allocation fails, this affects the rest of the routine if it us that resource. This should be detected and proper action taken. In some cas, the "proper action" may simply be to log the error.
函数返回时,所有出错恰当的处理。如果该错误影响到接下来程序的执行(比如资源分配失败),通常可以简单的写log文件来处理。
Are resources and memory relead in all error paths?
Make sure all resources and memory allocated are relead in the error paths.
在出错时,确保所有资源包括内存 分配被释放。
Are all thrown exceptions handled properly?
If the source code us a routine that throws an exception, there should be a function in the call stack that catches it and handles it properly.

本文发布于:2023-06-25 10:05:05,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1035483.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:代码   注释   是否   评审   描述   确保   风格   需要
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图