This issue describes what the Go analyzer should check for in the card-tricks exercise.
Function GetItem
- no
else should be used
- early return should be used which makes a total sum of 2 return statements.
- there needs to be exactly one
if statement (with 2 conditions)
- no
switch should be used
Function SetItem
- all 4 checks of
GetItem apply here as well
Function PrefilledSlice
- check instantiation of the slice. It should be created with a
len or cap given
- check for a for loop (no
range, not recursive)
Function NumberRow
- check instantiation of the slice. No
make or new should be used but a nil slice created with var xy []int
- optional: check if for loop increases index (
for i := 1; true; i++)
Function RemoveItemPure
- all 4 checks of
GetItem apply here as well
- shouldn't use a
for loop, only append
Function RemoveItem
- all 4 checks of
GetItem apply here as well
This issue describes what the Go analyzer should check for in the
card-tricksexercise.Function
GetItemelseshould be usedifstatement (with 2 conditions)switchshould be usedFunction
SetItemGetItemapply here as wellFunction
PrefilledSlicelenorcapgivenrange, not recursive)Function
NumberRowmakeornewshould be used but a nil slice created withvar xy []intfor i := 1; true; i++)Function
RemoveItemPureGetItemapply here as wellforloop, onlyappendFunction
RemoveItemGetItemapply here as well