From a finding to a verified fix
A small educational shopping-cart project. Explore the findings, inspect the code, and compare the scan after the fixes.
demo / cart-example
97/100
Maintenance score · A
3 findings: 1 warning and 2 notes
The score stays high: debugging leftovers do not make the whole project unhealthy. The priority here is .only, which prevents other tests from running.
Findings and actions
Leftover console.log in sourcesrc/cart.ts:2Note
Check whether console.log is debugging output and remove it if so.
export function subtotal(prices: number[]) {
console.log('calculating subtotal', prices);
debugger;
return prices.reduce((sum, price) => sum + price, 0);
}
Leftover debugger in sourcesrc/cart.ts:3Note
Remove the debugger statement from source.
export function subtotal(prices: number[]) {
console.log('calculating subtotal', prices);
debugger;
return prices.reduce((sum, price) => sum + price, 0);
}
Disabled coverage: focused test (.only)tests/cart.test.ts:3Warning
Replace it.only with it so all tests can run.
import { it, expect } from 'vitest';
import { subtotal } from '../src/cart';
it.only('adds prices', () => {
expect(subtotal([2, 3])).toBe(5);
});
it('handles an empty cart', () => {
expect(subtotal([])).toBe(0);
});
Now see what is happening in your project.
Scan a repository