typhonjs-node-escomplex / typhonjs-escomplex

Next generation complexity reporting for Javascript & Typescript based on the Babel parser.
Other
110 stars 9 forks source link

Question about Error handling #21

Closed mx0c closed 4 years ago

mx0c commented 4 years ago

Hey there,

i need to analyze a ES6 JS Project but the AST Generator throws an error:

error: Failed analyzing:/usr/src/app/workdir/public/pdfjs/web/viewer.js: state.generator[node.type] is not a function TypeError: /usr/src/app/workdir/public/pdfjs/web/viewer.js: state.generator[node.type] is not a function\n at /usr/src/app/nod e_modules/typhonjs-escomplex-commons/dist/utils/ast/ASTGenerator.js:104:42\n at Array.forEach ()\n at Function.parseNodes (/usr/src/app/node_modules/typhonjs-escomplex-commons/dist/utils/ast/ASTGenerator.js:97:16)\n at Object.identifier (/usr/src/app/node_modules/escomplex-plugin-syntax-estr ee/dist/PluginSyntaxESTree.js:1315:104)\n at TraitHalstead.valueOf (/usr/src/app/node_modules/typhonjs-escomplex-commons/dist/module/traits/TraitHalstead.js:130:96)\n at /usr/src/app/node_modules/typhonjs-escomplex-commons/dist/module/traits/HalsteadArray.js:130:45\n at Array.filter ()\n at HalsteadArray.valueOf (/usr/src/app/node_modules/typhonjs-escomplex-commons/dist/module/traits/HalsteadArray.js:129:33)\n at _loop (/usr/src/app/node_modules/escomplex-plugin-metrics-module/dist/ModuleMetricProcess.js:330:40)\n at Function.processSyntax (/usr/src/app/node_modules/escomplex-plugin-metri cs-module/dist/ModuleMetricProcess.js:339:13)

I suppose this error comes from unsupported JS Syntax. My question is, if i can somehow ignore errors, and further analyze the project. I have used the escomplex.analyzeProject(sources, {ignoreErrors: true}); function.

thanks in advance.