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

[BUG] error count seems to not work as expected #15

Closed
juliensnz opened this issue Oct 17, 2022 · 3 comments · Fixed by #17
Closed

[BUG] error count seems to not work as expected #15

juliensnz opened this issue Oct 17, 2022 · 3 comments · Fixed by #17

Comments

@juliensnz
Copy link

Hello, when I run knip on my project, I get unused types in my report but the command still returns 0 as exit code.

By reading the code here

const reportGroup = report.files ? 'files' : (Object.keys(report) as IssueGroup[]).find(key => report[key]);
const counterGroup = reportGroup === 'unlisted' ? 'unresolved' : reportGroup;
if (counterGroup) {
  const count = counters[counterGroup];
  if (count > Number(maxIssues)) process.exit(count);
}

It seems to always take the file counter instead of aggregating all the counters. Is it expected?

I can do a pull request if you need help :)

@webpro
Copy link
Collaborator

webpro commented Oct 17, 2022

Thanks for raising this. I had some reasoning to this, but an aggregate count is definitely very reasonable to expect. Now I'm thinking it only makes sense to use the total count. Just exclude types that should not make CI jobs fail. Would you be up for a PR?

@juliensnz
Copy link
Author

Yes, of course!

@juliensnz
Copy link
Author

juliensnz commented Oct 18, 2022

There you go :) #17

Tell me if I am missing something or if you want me to do more testing on this!

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

Successfully merging a pull request may close this issue.

2 participants