leasot
Version:
Parse and output TODOs and FIXMEs from comments in your files
19 lines (18 loc) • 566 B
JavaScript
import crypto from 'crypto';
export const reporter = (todos, config = { spacing: 2 }) => JSON.stringify(todos.map((todo) => {
return {
description: `${todo.tag} ${todo.text}`,
check_name: 'leasot',
fingerprint: crypto
.createHash('md5')
.update(`${todo.tag}${todo.text}${todo.file}${todo.line}`)
.digest('hex'),
severity: 'info',
location: {
path: todo.file,
lines: {
begin: todo.line,
},
},
};
}), null, config.spacing);