exercism / exercism/exalysis

isogram: false positive on variable declaration with zero value

Open
#76 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
33
Forks
13
PR merge metrics
No merged PRs in 30d

Description

False positive on solution: https://exercism.io/mentor/solutions/6356bab9214544fe85b37b0c646c183b?iteration_idx=3

```go
package isogram

import (
"strings"
"unicode"
)

//IsIsogram returns true if string is isogram
func IsIsogram(word string) bool {
wordUpper := strings.ToUpper(word)
for i := 0; i < len(wordUpper); i++ {
if unicode.IsLetter(rune(wordUpper[i])) {
if strings.Count(wordUpper, string(wordUpper[i])) > 1 {
return false
}
}
}
return true
}
```

Wrong output:
- If you're declaring a variable which can be initialized with its [zero value](https://golang.org/ref/spec#The_zero_value), then `var s string` is more idiomatic than an assignment: `s := ""`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the report with the Go solution and the zero-value declaration shown in the issue, then search the analyzer for the emitted wording. Done means the analyzer no longer reports this message for the shown valid declaration.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.