Code Review Report Sample

You might also like

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 91

Ho Chi Minh City University of Technology - VNUHCM

Course: Software Testing Class: L01 Semester 1 - Year 2021-2022


Code Review Campaign - 02-Oct-2021

Group name: XXXX


No. Family name First name Student Code Role Contribution
1 Nguyễn Văn A 1810001 Leader 15%
2
Job
App1/Code1.java: main job App1/Code2.java: partial
Check Code

1
2
3
4

6
7
8
9
10
11
12

13
14
15

16
17

18
19

20
21
22
23

24
25
26
27
28
29

30
31
32
33
34
35
36
37
38

39
40
41
42

43
44

45
46
47
48
49
50
51
52

53
54

55

56
57
58
59

60
61

62
63

64

65
66
Check code description
I - DEVIATION OBJECTIVE
# I.1 – DEVIATION
Does the code correctly implement the design?
Does the code implement more than the design?
Is every parameter of every method passing mechanism (value or reference) appropriate?
Does every method return the correct value at every method return point?
II – OMISSION OBJECTIVE
# II.1 –OMISSION
Does the code completely implement the design?
III - DEFECT OBJECTIVE
# III.1 – Variable and Constant Declaration
Are descriptive variable and constant names used in accord with naming conventions?
Is every variable correctly typed?
Is every variable properly initialized?
Are all for-loop control variables declared in the loop header?
Are there variables that should be constants?
Are there attributes that should be local variables?
Do all attributes have appropriate access modifiers (private, protected, public)?
# III.2 – Method Definition
Are descriptive method names used in accord with naming conventions?
Do all methods have appropriate access modifiers (private, protected, public)?
Is every method parameter value checked before being used?
# III.3 – Class Definition
Does each class have an appropriate constructor?
Do any subclasses have common members that should be in the superclass?
# III.4 – Data Reference
For every array reference: Is each subscript value within the defined bounds?
For every object or array reference: Is the value certain to be non-null?
# III.5 – Computation/Numeric
Are there any computations with mixed data types?
Is overflow or underflow possible during a computation?
Are parentheses used to avoid ambiguity?
Are divisors tested for zero or noise?
# III.6 – Comparison/Relational
For every boolean test: Is the correct condition checked?
Are the comparison operators correct?
Is each boolean expression correct?
Are there improper and unnoticed side-effects of a comparison?
Has an "&" inadvertently been interchanged with a "&&" or a "|" for a "||"?
Is every three-way branch (less,equal,greater) covered?
# III.7 – Control Flow
Will all loops terminate?
When there are multiple exits from a loop, is each exit necessary and handled properly?
Does each switch statement have a default case?
Are missing switch case break statements correct and marked with a comment?
Can any nested if statements be converted into a switch statement?
Are null bodied control structures correct and marked with braces or comments?
Does every method terminate?
Are all exceptions handled appropriately?
Do named break statements send control to the right place?
# III.8 – Input/Output
Have all files been opened before use?
Have all files been closed after use?
Is buffered data flushed?
Are files checked for existence before attempting to access them?
# III.9 – Module Interface
Are the number, order, types, and values of parameters in every method call in agreement with the called method's declaration
Do the values in units agree (e.g., inches versus yards)?
# III.10 – Comment
Does every method, class, and file have an appropriate header comment?
Does every attribute,variable or constant declaration have a comment?
Is the underlying behavior of each method and class expressed in plain language?
Is the header comment for each method and class consistent with the behavior of the method or class?
Are all comments consistent with the code?
Do the comments help in understanding the code?
Are there enough comments in the code?
Are there too many comments in the code?
# III.11 – Layout and Packing
Is a standard indentation and layout format used consistently?
For each method: Is it no more than about 60 lines long?
# III.12 – Storage Usage
Are arrays large enough?
# III.13 – Performance
Can the cost of recomputing a value be reduced by computing it once and storing the results?
Is every result that is computed and stored actually used?
Can a computation be moved outside a loop?
Are there tests within a loop that do not need to be done?
V – AMBIGUITY OBJECTIVE
# V.1 – Variable and Constant Declaration
Are there variables with confusingly similar names?
Are all variables properly defined with meaningful, consistent, and clear names?
VI – REDUNDANCE OBJECTIVE
# VI.1 – Variables
Are there any redundant or unused variables or attributes?
Could any non-local variables be made local?
# VI.2 – Method Definition
Are there any uncalled or unneeded methods?
# VI.3 – Performance
Can any code be replaced by calls to external reusable objects?
Are there any blocks of repeated code that could be condensed into a single method?
e called method's declaration?
Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
240,
28 "||"?
Is every three-way branch 347
271,
29 (less,equal,greater) covered? 300
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
Yes
Yes
Yes
No
No
Trường hợp > chưa được xét đến
Yes
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||
Bổ sung lệnh else

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct 191
condition checked?
25 Are the comparison operators
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
262,
29 (less,equal,greater) covered? 291,
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place? 192
24-38

Comment
if(cnt++); long cannot be converted to boolean
Yes
Yes
No
No
Trường hợp > chưa được xét đến
Yes
N/A
N/A
N/A
No
N/A
Yes
yes
if(cnt)++; break;
Suggestion / Fix ?
Xóa đoạn code vô nghĩa

Thay & bằng &&

Thay | bằng ||
Bổ sung lệnh else

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place? 192
24-38

Comment
yes
Yes
Yes
No
No
N/A
Yes
N/A
N/A
N/A
No
N/A
Yes
yes
yes
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
yes
Yes
Yes
No
N/A
Yes
N/A
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and 306
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate? 306-
37 appropriately?
Do named break statements send 310
38 control to the right place?
24-38

Comment
yes
Yes
Yes
No
N/A
Yes
for (; ; i++)
N/A
N/A
N/A
No
N/A
Yes
Có thể gây ra exception khi sử dụng các array, vì có thể
vượt size của Array lúc khởi tạo
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

for(int i=0;i<99;i++)

for(int i=0;i<99;i++)
Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison 302
correct?
26 Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
yes
if(flag=0)
Yes
No
N/A
Yes
yes
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

if(flag==0)

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
yes
Yes
Yes
No
N/A
Yes
yes
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
yes
Yes
Yes
No
N/A
Yes
yes
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
yes
Yes
Yes
No
N/A
Yes
yes
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct?
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a
28 "||"?
Is every three-way branch 102
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
yes
Yes
Yes
No
if(tfusername.getText().equals("") | tfusername.getText().e

Yes
NA
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

if(tfusername.getText().equals("") ||tfusername.getText().equals("*"))

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
yes
Yes
Yes
No
N/A
Yes
yes
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
yes
Yes
Yes
No
N/A
Yes
yes
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
yes
Yes
Yes
No
N/A
Yes
yes
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception


Code Review Report
Project Code: [Project name] / [File name]
Version of the work product:
Reviewer(s): Trần Quốc Tố

Review date & time:


Work product' size (LoC)
Effort spent on review (man-hour):

Check code Check code Description Line


24 For every boolean test: Is the correct
25 condition checked? operators
Are the comparison
26 correct?
Is each boolean expression correct? 345
Are
Has there
an "&"improper and unnoticed
inadvertently been
27 side-effects of a comparison?
interchanged with a "&&" or a "|" for a 105,
28 "||"?
Is every three-way branch 347
29 (less,equal,greater) covered?
When there are multiple exits from a
30 loop,
Will all
is loops terminate?
each exit necessary and
31 handled
Does properly?
each switch
Are missing switchstatement
case breakhave a
32 default case?
statements correct and marked with
33 aCan
comment?
anybodied
nestedcontrol
if statements be
Are null structures
34 converted into a switch statement?
correct and marked with braces or
35 comments?
36 Does
Are allevery methodhandled
exceptions terminate?
37 appropriately?
Do named break statements send
38 control to the right place?
24-38

Comment
N/A
N/A
N/A
No
N/A
N/A
N/A
N/A
N/A
N/A
No
N/A
Yes
yes
N/A
Suggestion / Fix ?

Thay & bằng &&

Thay | bằng ||

Nên sử dụng try...catch để xử lý exception

You might also like