Merged
Conversation
- Add zero-division check before calculating percentage (line 410)
- Display '0.0%' instead of 'NaN%' when totalWordsToTranslate is 0
- Fixes #{ISSUE_NUMBER}
This occurs when all target locales have 100% translation completion,
causing division by zero: (0 / 0) * 100 = NaN
Addresses CI/CD pipeline failures, monitoring integration issues,
and stakeholder confusion outlined in #{ISSUE_NUMBER}
The-Best-Codes
suggested changes
Nov 9, 2025
Contributor
The-Best-Codes
left a comment
There was a problem hiding this comment.
Nice PR 🎉
Don't forget to run pnpm run format and add a changeset with pnpm new before this PR can be merged!
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a division-by-zero issue in the status command that causes "NaN%" to be displayed when all target locales have 100% translation completion. The fix adds a guard to check if totalWordsToTranslate is zero before performing the division.
Key changes:
- Added conditional check to prevent division by zero when calculating per-language breakdown percentages
- Returns "0.0" when
totalWordsToTranslateis 0 instead of computing NaN
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/cli/src/cli/cmd/status.ts | Added guard condition to prevent division by zero in per-language breakdown percentage calculation |
| .changeset/rude-spies-smoke.md | Added changeset entry documenting the bug fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
maxprilutskiy
approved these changes
Nov 12, 2025
Contributor
|
@Dishantydv7 there's a failing check, please resolve this and I'll merge. |
17prateek12
pushed a commit
to 17prateek12/lingo.dev
that referenced
this pull request
Jan 23, 2026
* fix: prevent NaN% in status command when all translations complete
- Add zero-division check before calculating percentage (line 410)
- Display '0.0%' instead of 'NaN%' when totalWordsToTranslate is 0
- Fixes #{ISSUE_NUMBER}
This occurs when all target locales have 100% translation completion,
causing division by zero: (0 / 0) * 100 = NaN
Addresses CI/CD pipeline failures, monitoring integration issues,
and stakeholder confusion outlined in #{ISSUE_NUMBER}
* chore: fix code style issues in status.ts
* chore(changeset): add changeset for fix/status-nan-percentage
---------
Co-authored-by: Max Prilutskiy <5614659+maxprilutskiy@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"Fixes #1309 — guard against division-by-zero in packages/cli/src/cli/cmd/status.ts. Returns 0.0% when totalWordsToTranslate is 0. "
This occurs when all target locales have 100% translation completion, causing division by zero: (0 / 0) * 100 = NaN
Addresses CI/CD pipeline failures, monitoring integration issues, and stakeholder confusion outlined in #1309