Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Work around bug in phpcs outputting invalid JSON #144

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a # FIXME: Remove when the above issue is fixed (Or below, I don't really care which).

Just to make it explicit that this is something that should be removed as soon as we can do so.

result = result.replace(/Time: \d+ms; Memory: \d+Mb$/, '')
result = JSON.parse(result.toString().trim())
catch error
atom.notifications.addError('Error parsing PHPCS response', {
Expand Down