Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when running with CodeClimate #90

Closed
alexlafroscia opened this issue Oct 27, 2015 · 5 comments
Closed

Errors when running with CodeClimate #90

alexlafroscia opened this issue Oct 27, 2015 · 5 comments

Comments

@alexlafroscia
Copy link

I keep getting some kind of parsing error when running Watson through CodeClimate against my codebase

error: (JSON::ParserError) 757: unexpected token at 'Oh Dear! I wasn't able to save the following files:
tests/unit/helpers/alias-or-default-test.js

A possible cause is having all the source code commented.
If that's not the problem please fill a report with the hospital directors
at https://github.com/abuiles/ember-watson/issues.


{"type":"Issue","check_name":"transformPrototypeExtensions","description":"Convert computed properties and observers to not use prototype ext
ensions","categories":["Style"],"location":{"path":"app/components/help-popover.js","lines":{"begin":1,"end":1}}}'

The contents of the file are thus:

import Ember from 'ember';

import aliasOrDefault from '../../../helpers/alias-or-default';
import { module, test } from 'qunit';

const { get } = Ember;

module('Unit | Helper | alias-or-default');

test('it returns the default if key is empty', function(assert) {
  assert.expect(1);
  const defaultObject = { 'default': 'stuff' };
  const obj = Ember.Object.extend({
    original: {},
    output: aliasOrDefault('original', defaultObject)
  }).create();
  const result = get(obj, 'output');
  assert.deepEqual(result, defaultObject, 'reading computed property had correct output');
});

test('it returns the default if key is empty', function(assert) {
  assert.expect(1);
  const defaultObject = { 'default': 'stuff' };
  const obj = Ember.Object.extend({
    output: aliasOrDefault('original', defaultObject)
  }).create();
  const result = get(obj, 'output');
  assert.deepEqual(result, defaultObject, 'reading computed property had correct output');
});

test('it aliases the correct key if it exists and has keys', function(assert) {
  assert.expect(1);
  const defaultObject = { 'default': 'stuff' };
  const originalObject = { 'legit': 'object' };
  const obj = Ember.Object.extend({
    original: originalObject,
    output: aliasOrDefault('original', defaultObject)
  }).create();
  const result = get(obj, 'output');
  assert.deepEqual(result, originalObject, 'reading computed property had correct output');
});

Any idea why it's choking on this file?

@marcioj
Copy link
Collaborator

marcioj commented Oct 27, 2015

Do you receive this error if you change const { get } = Ember; to var get = Ember;?

@alexlafroscia
Copy link
Author

@marcioj Do you mean var get = Ember.get;?

Edit: When using var get = Ember.get;, that file no longer errors, although now I'm getting errors in other files...

@marcioj
Copy link
Collaborator

marcioj commented Oct 27, 2015

@marcioj Do you mean var get = Ember.get;?

Yes, sorry for the typo

@alexlafroscia
Copy link
Author

The other files that seem to have errored seem to all use a similar syntax, but there are dozens more that use it as well that do not seem to error. Any ideas as to why it might be happening? I'm also curious as to why there's that json blob at the bottom that references a totally different file. It seems to reference prototype extensions, but the file it references doesn't contain any.

@alexlafroscia
Copy link
Author

Alright, so I looked into it deeper and it turns out that CodeClimate uses a really old version of Watson that uses a totally different API. It's unsurprising that it's not working as expected, since the installation is done as:

npm install -g mrb/ember-watson.git#95387b7

which maybe refers to a previous owner of the repo? Either way, it's probably not a concern for any current maintainers. I'm curious, though, does Watson no longer support a "dry run"? If it does, the CodeClimate package could be updated to use the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants