synt

Similar code analysis.

synt

Similar code analysis.

This project is still < v1.0.0.

It is currently under active development, and is subject to change at anytime.

  • Latin
  • JavaScript
  • CoffeeScript
  • Ruby
  • Haskell

Depending on what you want to analyze, you will need various things installed.

Windows users, see: Issue #30.

There are various ways to install.

The NPM package can technically support every language, and shells out to other language implementations if they have been setup and compiled successfully.

You should be able to install this on a system with only Node/NPM, and if you have Bundler, Ruby, etc, then synt ... -l rb should work, or for Haskell, synt ... -l hs and so on.

If you want, for example, just Ruby or Haskell support, you can install their sub projects on their own, via their own package managers (detailed further below).

npm install synt
npm install -g synt

The usual way to install a global package with NPM is as root.

Example: using sudo:

sudo npm install -g synt

However, this seems to cause issues when using Bundler in the postinstall script.

The package should still install without issue, but, to get this working, you may have to:

sudo gem install bundler

Also, once you have it installed as root, it seems that, with the way Bundler asks for root access, paired with how NPM runs its package scripts as the nobody user, you may have a few WTF moments..

Try this:

sudo npm install -g synt --unsafe-perm

Bundler will complain, but it should work (please file bug if not, for any reason!).

Or, if you are using RVM, its rvmsudo command works great:

rvmsudo npm install -g synt

If you want just Ruby support, you can instead:

gem install synt

See the ruby/ folder for its implementation.

For just Haskell support:

cabal install synt

See the haskell/ folder for its implementation.

synt --help/-h

Note: The usage between various language specific CLIs will share the same core interface.

wget http://code.jquery.com/jquery-2.1.1.js
wget http://code.jquery.com/jquery-2.1.0.js
synt -c jquery-2.1.0.js -t jquery-2.1.1.js

In CoffeeScript:

synt = require "synt"
opts = compare: xto: y...
synt.compare opts

Note: This primarily deals with tooling in JavaScript. Other language testing, etc are encapsulated within these. Essentially, npm run is your go to command line tool.

To get started:

git clone git@github.com:brentlintner/synt.git
cd synt
npm run dev-setup
npm install
npm test
npm run test-cov

To compile, run

npm run compile

Code is written in modular, functional CoffeeScript.

  • bin -> any scripts- primarily used as npm scripts in package.json.
  • src -> any library coffee script files, and other src files.
  • lib -> output of coffee script compilation.
  • ruby -> any ruby support files
  • haskell -> any haskell support files
  • test -> any testing files (coffee script and compiled js).

Various algorithms are used to calculate similarity indexes between program tokens and trees.

This library currently supports these:

This project ascribes to semantic versioning.

synt is short for synteny, and is an (attempted) play on comparing code evolution to genetic (evolution).

This project is licensed under the ISC license.

Any contributions made to this project are made under the current license.

Current list of contributors.

Any contributions are welcome and appreciated!

All you need to do is submit a Pull Request.

  1. Please consider tests and code quality before submitting.
  2. Please try to keep commits clean, atomic and well explained (for others).

Current issue tracker is on github.

Even if you are uncomfortable with code, an Issue helps!

This project ascribes to Bantik's contributor covenant.