This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206973 - Find duplicate code blocks in project
Summary: Find duplicate code blocks in project
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-06 07:45 UTC by Vladimir Riha
Modified: 2015-09-22 08:29 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2012-01-06 07:45:37 UTC
Quite often you can have some repeated code blocks in project and this function would help you to find then and possibly replace with method call. Also option to specify minimum number of lines of code that could be marked as duplicate and some other options would be great.
Comment 1 acarlstein 2012-05-01 19:10:17 UTC
I agree with 'vriha'.

It is very often that many programmers (specially when working with open source code) do copy and paste of pieces of code.

You finish with duplicates all around a single project.

Having a plugin which allows to spot them would be of great help.
Comment 2 dayou 2013-01-19 14:06:38 UTC
https://github.com/hudayou/fib

Here is a tool to find identical code blocks in a file or directory
Comment 3 Christian Lenz 2014-10-16 10:47:01 UTC
This feature is really needed. There is a plugin called PMD Copy and Paste detector http://plugins.netbeans.org/plugin/1529 but first it is not further developed and second I got the sources from the developer and I'm searching for help (bug fixes, enhancements and so on.) Here is the code: https://github.com/Chris2011/Nb-Pmd-Cpd. Maybe someone can help me with  my "fork".


Regards

Chris
Comment 4 Christian Lenz 2015-09-22 08:29:56 UTC
What I prefer is a whole new menu entry called analyze, like the source -> inspect menu entry but it should be on first level navigation like source, refactor, run and so on, like in intelliJ. You have a lot of functionality like find duplicates, and so on.