Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When presented with multiple paths, analysis is only reported for the last one #22

Closed
ainar-g opened this issue Aug 18, 2023 · 1 comment · Fixed by #24
Closed

When presented with multiple paths, analysis is only reported for the last one #22

ainar-g opened this issue Aug 18, 2023 · 1 comment · Fixed by #24
Assignees
Labels
good first issue Good for newcomers

Comments

@ainar-g
Copy link

ainar-g commented Aug 18, 2023

func analyze(paths []string) ([]gocognit.Stat, error) {
var (
stats []gocognit.Stat
err error
)
for _, path := range paths {
stats, err = analyzePath(path)
if err != nil {
return nil, err
}
}
return stats, nil
}

If err is nil, stats is simply overwritten instead of being merged. The for loop implies that gocognit should accept several packages, and in fact it does, but only reports stats for the last package, ignoring the rest.

I think, it should either merge the stats or print an error telling that it only supports one path.

@uudashr uudashr added the good first issue Good for newcomers label Aug 31, 2023
@uudashr uudashr self-assigned this Sep 4, 2023
uudashr added a commit that referenced this issue Sep 4, 2023
@ainar-g
Copy link
Author

ainar-g commented Sep 5, 2023

I can confirm that the bug is fixed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants