change percventage to size in bytes
Change summary
- Updated the Webpack duplicate-code metric to report duplicate module size in bytes instead of percentages.
- Adjusted metric configuration to use file-size formatting and treat higher duplicate values as regressions.
- Refreshed extractor tests, duplicate-package insights, and report snapshots to align with the new byte-based metric.
Summary by CodeRabbit
- New Features
- Duplicate code is now reported as total size (file size) instead of a percentage, with clearer labeling that smaller is better.
- Bug Fixes
- Duplicate package insights are downgraded from error to warning, with updated wording (e.g., “Bundle contains X duplicate packages”).
- Tests
- Re-enabled a previously isolated test and updated expectations to align with new duplicate code sizing and insight severity.
- Chores
- Added ignore rules for test output artifacts to reduce noise in version control.
Walkthrough
- Added packages/utils/jest-output.txt containing a single whitespace and updated .gitignore to ignore **/jest-output.txt.
- In packages/utils/src/webpack/extract/modules.ts, switched duplicateCode from a percentage to a raw duplicate code size; removed lodash/round, totalCodeSize accumulation, and percentage calculations.
- Updated metrics in packages/utils/src/webpack/metrics.ts: DUPLICATE_CODE now describes total duplicate size, type changed from Percentage to FileSize, biggerIsBetter set to false.
- Adjusted tests:
- modules-packages-duplicate.ts: removed describe.only; changed expected insight type from error to warning; updated message wording/counts.
- modules.ts: updated expected duplicateCode values to large absolute sizes (e.g., 600, 5000).
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title Check | ✅ Passed | The title succinctly summarizes the main change of reporting the duplicate-code metric in bytes instead of a percentage. It is concise, clear, and directly aligned with the pull request's objectives. This focus helps teammates quickly grasp the core update when scanning PR history. |
| Docstring Coverage | ✅ Passed | No functions found in the changes. Docstring coverage check skipped. |
✨ Finishing touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between e7198506cb7ae2c4ad1ba437fd73d14331d0faca and a702f494b966eb71bf46648208b4c301b14e6e52.
📒 Files selected for processing (1)
.gitignore(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- .gitignore
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
No dependency changes detected. Learn more about Socket for GitHub.
👍 No dependency changes detected in pull request
@Joaco2603 Thank you for the PR! I will take a closer look at it in the coming days.
#12695 Bundle Size — 382.66KiB (-0.02%).
a702f49(current) vs 89d8cd8 master#12692(baseline)
[!WARNING] Bundle contains 2 duplicate packages – View duplicate packages
Bundle metrics
3 changes
1 regression
1 improvement
| Current #12695 |
Baseline #12692 |
|
|---|---|---|
335.02KiB(~+0.01%) |
335.01KiB |
|
47.64KiB(-0.2%) |
47.74KiB |
|
41.09% |
28.62% |
|
3 |
3 |
|
4 |
4 |
|
701 |
701 |
|
0 |
0 |
|
0% |
0% |
|
39 |
39 |
|
1 |
1 |
Bundle size by type
2 changes
1 regression
1 improvement
| Current #12695 |
Baseline #12692 |
|
|---|---|---|
335.02KiB (~+0.01%) |
335.01KiB |
|
47.64KiB (-0.2%) |
47.74KiB |
Bundle analysis report Branch Joaco2603:feature/duplicateCode_... Project dashboard
Generated by RelativeCI Documentation Report issue