Skip to content

annapiatkova/NIL

 
 

Repository files navigation

NIL extended to JavaScript

An extension of NIL clone detector supporting JavaScript.

Usage

Same as the original NIL but --language option can be set to js or javascript.

Benchmark

You can measure the recall and precision of any clone detection tool supporting JavaScript as a target language by executing it on the benchmark directory and running evaluateRecallAndPrecision.py on the result file.

The file with clone pairs must be in format

dir_A,file_A,start_line_A,end_line_A,dir_B,file_B,start_line_B,end_line_B

, the same as for BigCloneEval. NIL outputs the result file in this format if -bce option is specified.

evaluateRecallAndPrecision.py takes 1 command line argument—the path to the file with clone pairs.

Example:

cd benchmark
python evaluateRecallAndPrecision.py ../result_5_10_70.csv

Options

Name Description Default
-s,--src Input source directory. You must specify the target dir. None
-mil,--min-line Minimum number of lines that a code fragment must be to be treated as a clone. 6
-mit,--min-token Minimum number of tokens that a code fragment must be to be treated as a clone. 50
-n,--n-gram N for N-gram. 5
-p,--partition-size The number of partitions. 10
-f,--filtration-threshold Threshold used in the filtration phase (%). 10
-v,--verification-threshold Threshold used in the verificatioin phase (%). 70
-o,--output Output file name. result_{n}_{f}_{v}.csv
-t,--threads The number of threads used for parallel execution (both the Preprocess and Clone detection phases) all threads
-l,--language Target language java
-bce,--bigcloneeval If you specify -bce option, NIL outputs result file feasible to BigCloneEval. not specified
-mif,--mutationinjectionframework If you specify -mif option, NIL outputs nothing except for the output file name as standard output. not specified

Languages

Name Option Extension
JavaScript js,javascript .js
Java java .java
C c .c,.h
C++ cpp .cpp,.hpp
C# cs,csharp .cs
Python py,python .py
Kotlin kt,kotlin .kt

About

Clone detector using N-gram, Inverted index, and LCS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 87.8%
  • JavaScript 7.3%
  • ANTLR 4.0%
  • Kotlin 0.9%
  • C# 0.0%
  • Python 0.0%