Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughParsedVersion now exposes Possibly related PRs
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/providers/completion-item/version.tssrc/providers/diagnostics/rules/deprecation.tssrc/providers/diagnostics/rules/upgrade.tssrc/providers/diagnostics/rules/vulnerability.tssrc/utils/version.tstests/utils/version.test.ts
2dff29c to
f083661
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/diagnostics/replacement.test.ts (1)
14-20: Consider asserting additional diagnostic properties for more robust coverage.The test verifies that a result is returned and has a message, but the
checkReplacementrule also returnsseverity,code, andnodeproperties. Asserting these would catch regressions more comprehensively.💡 Optional: More comprehensive assertions
it('should flag when replacement found', async () => { const result = await checkReplacement(createReplacementContext('left-pad')) expect(result).toBeDefined() expect(result!.message).toBeDefined() + expect(result!.severity).toBeDefined() + expect(result!.code).toBeDefined() })
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/providers/diagnostics/rules/upgrade.tstests/diagnostics/deprecation.test.tstests/diagnostics/replacement.test.tstests/diagnostics/upgrade.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/providers/diagnostics/rules/upgrade.ts
There was a problem hiding this comment.
🧹 Nitpick comments (2)
tests/__setup__/msw.ts (2)
19-71: Hoist static vulnerability fixtures out of the handler.
resultsis reconstructed on every request (from Line 21). Move it to module scope to avoid repeated allocation and keep the handler focused on request routing.Proposed refactor
+const vulnerabilityResults: Record<string, Record<string, unknown>> = { + 'pkg-crit@1.0.0': { + package: 'pkg-crit', + version: '1.0.0', + vulnerablePackages: [], + deprecatedPackages: [], + totalPackages: 1, + failedQueries: 0, + totalCounts: { total: 1, critical: 1, high: 0, moderate: 0, low: 0 }, + }, + 'pkg-multi@1.0.0': { + package: 'pkg-multi', + version: '1.0.0', + vulnerablePackages: [], + deprecatedPackages: [], + totalPackages: 1, + failedQueries: 0, + totalCounts: { total: 3, critical: 1, high: 2, moderate: 0, low: 0 }, + }, + 'pkg-fix@1.0.0': { + package: 'pkg-fix', + version: '1.0.0', + vulnerablePackages: [{ + name: 'pkg-fix', + version: '1.0.0', + depth: 'root', + path: [], + vulnerabilities: [{ id: 'GHSA-1', summary: '', severity: 'high', aliases: [], url: '', fixedIn: '1.2.0' }], + counts: { total: 1, critical: 0, high: 1, moderate: 0, low: 0 }, + }], + deprecatedPackages: [], + totalPackages: 1, + failedQueries: 0, + totalCounts: { total: 1, critical: 0, high: 1, moderate: 0, low: 0 }, + }, + 'pkg-safe@1.0.0': { + package: 'pkg-safe', + version: '1.0.0', + vulnerablePackages: [], + deprecatedPackages: [], + totalPackages: 1, + failedQueries: 0, + totalCounts: { total: 0, critical: 0, high: 0, moderate: 0, low: 0 }, + }, +} + const server = setupServer( http.get(`${NPMX_DEV_API}/replacements/:name`, ({ params }) => { @@ http.get(`${NPMX_DEV_API}/registry/vulnerabilities/:name/v/:version`, ({ params }) => { const key = `${params.name}@${params.version}` - const results: Record<string, Record<string, unknown>> = { - ... - } - - const data = results[key] + const data = vulnerabilityResults[key] return data ? HttpResponse.json(data) : new HttpResponse(null, { status: 404 }) }), )
22-39: Make fixture payloads internally consistent.At Line 22 and Line 31,
totalCounts.totalis non-zero whilevulnerablePackagesis empty. Consider adding representative vulnerability entries so tests don’t pass against an unrealistic response shape.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/providers/diagnostics/rules/upgrade.tssrc/providers/hover/npmx.tstests/__setup__/msw.tstests/diagnostics/upgrade.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/providers/hover/npmx.ts
maxSatisfyingto handle version rangeupgradediagnostics