From 9a365105cb47fa3d12b21bc80f62796301320360 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 22 Apr 2016 20:28:26 -0700 Subject: [PATCH] Work around bug in phpcs outputting invalid JSON See https://github.com/squizlabs/PHP_CodeSniffer/issues/969 --- lib/main.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/main.coffee b/lib/main.coffee index 7d4c336..c1baf40 100644 --- a/lib/main.coffee +++ b/lib/main.coffee @@ -135,6 +135,8 @@ module.exports = if confFile then execOptions.cwd = path.dirname(confFile) return helpers.exec(command, parameters, execOptions).then (result) => try + # Strip time+memory information at the end; workaround for https://github.com/squizlabs/PHP_CodeSniffer/issues/969 + result = result.replace(/Time: \d+ms; Memory: \d+Mb$/, '') result = JSON.parse(result.toString().trim()) catch error atom.notifications.addError('Error parsing PHPCS response', {