UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

41 lines (34 loc) 1.21 kB
// Good comment: explains why, not what function calculateTax(amount, rate) { // Apply tax rate with rounding to avoid floating point errors return Math.round(amount * rate * 100) / 100; } // Bad comment: states the obvious function addNumbers(a, b) { // Add a and b together return a + b; } // Outdated comment (misleading) function getUsers() { // Returns array of user IDs return users.map(user => ({ id: user.id, name: user.name })); // Actually returns objects } // Commented out code (code smell) function processData(data) { // const oldWay = data.filter(x => x.valid); // return oldWay.map(x => x.value); // New approach using reduce return data.reduce((acc, item) => { if (item.valid) { acc.push(item.value); } return acc; }, []); } // TODO and FIXME comments function incompleteFunction() { // TODO: implement error handling // FIXME: memory leak in loop // HACK: temporary workaround return 'placeholder'; }