Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

feat: improve condition for test case #15

Merged
merged 1 commit into from Jul 20, 2022
Merged

feat: improve condition for test case #15

merged 1 commit into from Jul 20, 2022

Conversation

sivchari
Copy link
Owner

improve #9

@@ -52,7 +52,7 @@ func report(pass *analysis.Pass, pos token.Pos, name string) {

// If prefix is Test or Benchmark, Fuzz, skip
// FYI https://go.dev/blog/examples
if strings.Contains(name, "Test") || strings.Contains(name, "Benchmark") || strings.Contains(name, "Fuzz") {
if strings.HasPrefix(name, "Test") || strings.HasPrefix(name, "Benchmark") || strings.HasPrefix(name, "Fuzz") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still not perfect because you will apply this matching on every Ident and not only functions inside test files with the right signature.
But it's much better, this will reduce false-positive and false-negative. 👍

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @ldez
I know. So I've planned to improve this linter 👍

@sivchari sivchari merged commit 941c1cf into main Jul 20, 2022
@sivchari sivchari deleted the improve-condition branch July 20, 2022 13:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants