s-expression errors
AndreyShpilevoy opened this issue · 9 comments
Hi all,
I faced with a very strange issue.
I receive this butch of errors
ERROR: couldn't find node type SpreadElement in Sexp::NODE_NAMES. ERROR: couldn't find node type SpreadProperty in Sexp::NODE_NAMES. ERROR: couldn't find node type YieldExpression in Sexp::NODE_NAMES. ERROR: couldn't find node type ImportNamespaceSpecifier in Sexp::NODE_NAMES. ERROR: couldn't find node type JSXEmptyExpression in Sexp::NODE_NAMES.
And there is no matter what I have in configuration or where it was running (docker or on web site)
Last time I receive this errors with configuration: Url
Hi @AndreyShpilevoy,
Thanks for submitting this issue! I'm happy to help.
I'm having trouble reproducing these errors, however. Using the Code Climate CLI, I was able to successfully analyze both the commit you linked to (ec68ba0) and the master branch in this project. Do you mind providing some more information so I can debug further? For example, either:
- a link to a failed build on codeclimate.com
- a commit where the error is reproducible with the Code Climate CLI
yep, it was on branch breadcrumbs
Here is a link to branch commit: Link
Here is a link to CodeClimate.com build - Link
Also, interesting, that on github I see that build was failed because of codeclimate — 382 issues to fix, but on the build, everything is ok, except exception of course.
One more interesting thing - on Code Climate CLI I had results when duplication engine return for me some valid result, but when I tried to set dump_ast: true option to config section - I got the same errors.
Thanks, @AndreyShpilevoy!
I now see where the couldn't find node type errors are being emitted. My apologies for missing them before. I'm digging into this now to determine the impact and come up with a fix. Please stand by.
Lastly, just to clarify—a Code Climate build can be successful, but cause a GitHub pull request to fail if there are issues found. Code Climate builds only "fail" in the case of an engine crashing, git clone failing, etc.
Thanks for your patience while I investigated this.
What we've found so far is that this does not have an impact on analysis accuracy. A change I'll be proposing shortly in a pull request is to reduce the severity of the couldn't find node type message to a warning, or omit it entirely.
Nice!
I hope it will be really helpful.
Because at the moment I can't get results from Code Climate CLI with dump_ast: true option.
Thank you for a fast feedback.
Hi @AndreyShpilevoy,
Sorry for the trouble using the dump_ast issue. It looks like there's an important bit of documentation that was missed when the instructions for using that option were written: there's a debug configuration option for the duplication engine that should be turned on within the .codeclimate.yml like so:
engines:
duplication:
enabled: true
config:
dump_ast: true
debug: true
languages:
javascript:
mass_threshold: 65
The CODECLIMATE_DEBUG=1 ENV in the README turns on the CLI's debug output, which allows you to see the stderr from the engine, but then the engine also needs debug turned on in addition to dump_ast to log the messages appropriately.
I'm going to open a PR in a minute to fix the README. Please let us know if adding the debug: option to your .codeclimate.yml as shown above helps: when I cloned your repo locally & ran CODECLIMATE_DEBUG=1 codeclimate analyze with those config changes, I saw AST information included in the output.
Apologies, @AndreyShpilevoy, @toddmazierski corrected me: the above config happened to work for me locally because I was running a pre-release version of our CLI which behaves a bit differently from the stable release. The config I provided will not work today with the stable CLI release because of a bug in this engine that does not recognize the debug option correctly.
I've opened a PR to fix that bug: #215. I'm verifying the fix now & will update here one it's shipped out.
Ok, I've verified that that #215 fixes the issue & the config above now works for me on the stable CLI.
You'll want to run codeclimate engines:install after re-enabling duplication in your config to ensure you have the new, fixed version of the engine.
I checked it with Code Climate CLI and on CodeClimate.com - everything works as expected.
Thank you.