jkennedy1980 / Objective-C-CPD-Language

A CPD language definition for use with Objective-C source code
http://deadmeta4.com/2011/05/17/objective-c-copy-paste-detection-using-jenkins/
MIT License
48 stars 60 forks source link

Option to discard folder from path #6

Closed soniccat closed 12 years ago

soniccat commented 12 years ago

I have --files 'path/to/trunk' option. But it contains the iOS Evernote SDK which code is generated and it contains a lot of copy pasted code blocks). For example NoteStore.m has 36072 lines of code and contains more than 200 copy pasted code blocks. I think the best way to fix that is ignore that by adding option to discard special path.

jkennedy1980 commented 12 years ago

This project (Objective-C-CPD-Language) is only a language definition for CPD and cannot make changes to the function of CPD itself. CPD supports the scanning of more than 1 folder from the command line by appending multiple --file arguments as seen in the example below. Perhaps you could point to multiple folders and exclude the evernote folder.

java net.sourceforge.pmd.cpd.CPD --minimum-tokens 100 --files [First Path] --files [Second Path] --language ObjectiveC --encoding UTF-8 --format net.sourceforge.pmd.cpd.XMLRenderer > cpd-output.xml

You could try getting the PMD/CPD guys to build this change into CPD or simply change your project structure so that included libraries are not in the same folder tree as your source code. I typically keep only my own source inside a Classes directory and keep all open source in a sibling folder.

PaulTaykalo commented 12 years ago

Another option is to run some script that outputs list of files with excludes / includes and pass it's results to cpd --files option.