exercism / exercism/go-analyzer

[V3] Analyzer extension for concept exercise: basic-slices

Open
#25 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10
Forks
11
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the Go analyzer code that handles the card-tricks/basic-slices exercise and the rules for GetItem, SetItem, PrefilledSlice, NumberRow, RemoveItemPure, and RemoveItem. Review how existing analyzer checks represent control flow, slice creation, loops, and append usage. Done means the listed constraints are checked for each function, including the optional NumberRow index check if supported, with analyzer tests updated or added where the project expects them.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.