AtomLinter / linter-codeclimate

An Atom Linter plugin for the Code Climate CLI
http://github.com/codeclimate/codeclimate
MIT License
10 stars 5 forks source link

SyntaxError: Unexpected token U #41

Closed JustinAiken closed 7 years ago

JustinAiken commented 7 years ago
$/usr/local/bin/codeclimate analyze -f json -e fixme -e rubocop 'app/models/participant_group.rb' < /dev/null
[{"categories":["Bug Risk"],"check_name":"XXX","description":"XXX found","location":{"lines":{"begin":104,"end":104},"path":"app/models/participant_group.rb"},"type":"issue","fingerprint":"b1e96f1f2803cc369857c89059435f24","engine_name":"fixme"},
{"categories":["Bug Risk"],"check_name":"TODO","description":"TODO found","location":{"lines":{"begin":104,"end":104},"path":"app/models/participant_group.rb"},"type":"issue","fingerprint":"44c38e8c732ec940654843bfce42a8b5","engine_name":"fixme"},
{"categories":["Bug Risk"],"check_name":"TODO","description":"TODO found","location":{"lines":{"begin":164,"end":164},"path":"app/models/participant_group.rb"},"type":"issue","fingerprint":"1d3bef4def8e65da20996e801519e74c","engine_name":"fixme"}]

$ /usr/local/bin/codeclimate --version
0.36.0
Arcanemagus commented 7 years ago

It looks like whatever codeclimate is returning within Atom is invalid JSON, will the developer tools let you place a breakpoint here to try to get the raw output?

JustinAiken commented 7 years ago

Hmm, setting the breakpoint there isn't working, but trying to step through gives me a backtrace now:

SyntaxError: Unexpected token U
    at parse (native)
    at process._tickCallback (internal/process/next_tick.js:103:7)
    at Object.provider.lint (/Users/jaiken/.atom/packages/linter-codeclimate/lib/linter-codeclimate.coffee:54:13)
    at promises.push.Promise.then._this.emitter.emit.linter (/Users/jaiken/.atom/packages/linter/lib/linter-registry.js:63:26)
    at /Users/jaiken/.atom/packages/linter/lib/linter-registry.js:62:23
    at Set.forEach (native)
    at LinterRegistry.lint (/Users/jaiken/.atom/packages/linter/lib/linter-registry.js:60:18)
    at /Users/jaiken/.atom/packages/linter/lib/linter.coffee:98:16
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at /Users/jaiken/.atom/packages/linter/lib/editor-linter.js:30:20
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/node_modules/event-kit/lib/emitter.js:129:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1156:27)
    at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1126:19)
    at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:755:26)
    at Pane.module.exports.Pane.saveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:734:18)
    at Pane.saveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:3:61)
    at Pane.module.exports.Pane.saveActiveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:717:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:695:35)
    at atom-workspace.commandRegistry.add.core:save (/Applications/Atom.app/Contents/Resources/app.asar/src/register-default-commands.js:220:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)
Arcanemagus commented 7 years ago

@JustinAiken sorry for not responding earlier.

Unfortunately we need the raw output that is being processed to see what is really wrong, all that stack trace tells us is that my guess that it is within the JSON.parse call is correct.

Once we get CI working I'm going to migrate this project to ES2017 so we can actually get proper breakpoints working, stupid CoffeeScript...