Skip to content
Javascript Static Analyzer
JavaScript CSS HTML Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
k8s
web
.gitignore
.jshintrc
Dockerfile
README.md
cloudbuild.yaml
index.js
package-lock.json
package.json

README.md

challenge-framework

JS Parser rationale

Both Acorn and Esprima support JS ES6 http://esprima.org/test/compare.html shows they take similar processing time: ~215ms to parse jQuery mobile, Angular 1, and React 0.13.

Esprima pros

  • Bigger userbase (based on Google search ranking)
  • Pretty web page
  • More unit tests
  • Tokenizer
  • ESLint uses it

Esprima cons

  • Code is twice as big as Acorn
    • Not a concern.
  • Fewer options
    • Acorn has huge extensibility via callbacks
    • Not needed in our use cases

I jumped into Esprima right away once I saw that it would fit my needs. I later did more research and found Acorn to be more nimble. If I were to start over, I would go with Acorn.

Future task list and rationale

  • Our whitelist and blacklist handles presence of certain tokens/blocks but isn't designed to handle different quantities.
  • Our AST parser doesn't try to go inside CallExpressions. Could be tricky since source code usually isn't readily available.
  • My Git commits are pretty bulky, but that's simply due to the ultra time constrained nature of this project.
  • Make "all good" result colored black or green instead of red.
  • Bug where it things the code is empty on reload. onchange isn't triggered.
  • Structure analysis: allow user to put in multiple expressions to check instead of just one.
  • I'd add raw esprima output to the API test page.
You can’t perform that action at this time.