What is the duplication detection threshold you are using?

We all agree that duplication is evil and should be avoided (do not repeat the principle itself). To ensure that the static analysis code should be used as Simian (Multi Language) or Clone Detective (Visual Studio Add-in)

I just read Ayenda about Kobe , where he says that:

8.5% Kobe is copied and pasted code. And this is set high with sensitivity if we set the threshold to 3, which I usually do reaches 12.5%.

I think 3 as a threshold is very low. In my company, we offer a qualitative analysis of the code as a service, the default threshold for duplication is set to 20, and there are many duplicates. I can’t imagine if we set it to 3, it would be impossible for our client to even think about a correction.

I understand Iyende’s opinion of Kobe: it is an official model and is sold as “designed to guide you in planning, architecture and implementation of Web 2.0 applications and services.” therefore, quality is expected to be high.

But for your project, what is the minimum threshold you use for duplication?

A related question: How fanatically do you eliminate code duplication?

+3
6

- , . API , , - . .

, , . , , -, .

, , , OO .., 4 5 , . , , , .

, , , , , , , , -, . , , , 20 . , , , , , , . , , , .

+3

, , ,

  • ​​
  • ( )

, . - . , , , .

+3

. , . , , , , .

+1

. ( "Clone Detective", , : " " - .)

Lisp - , 2. , , - . ( , , , - LOOP, LOOP .)

, , , . , . , ( , , , ). , , .

, , " ". , , " , , ". DRY - . , . - - , .

+1

,

  • ""
    , , , , , , .
  • , , .

, / .

+1

CloneDR , , , , langauge. Java, #, COBOL, ++, PHP .

It takes a number of parameters to determine “What is a clone?”, Including: a) a similarity threshold that controls how similar two code blocks should be declared clones (usually 95% is good) b) the number of minimum clone sizes of lines (3 - a good choice) c) number of parameters (excellent text changes, 5 - a good choice) With these settings, he usually finds 10-15% of the excess code for almost everything that he processes.

0
source

All Articles