Closed exabugs closed 6 years ago
pip install hacking
@see: https://qiita.com/kitsuyui/items/5ab4608003a29ff7689f
function lint_python({ fp }, callback) { const bin = 'flake8'; const command = [bin, fp]; exec(command.join(' '), (err, buff = '') => { const reports = buff.split('\n'); const data = reports.reduce((memo, line) => { const info = line.match(/[^:]+:(\d+):(\d+): (.+)/); if (info) { const [b, l, p, message] = info; memo.push({ from: Pos(l, p), to: Pos(l, p + 1), message, severity: 'warning', }); } return memo; }, []); callback(err, data); }); }
@see: https://qiita.com/kitsuyui/items/5ab4608003a29ff7689f