-
Notifications
You must be signed in to change notification settings - Fork 2
Description
To simplify the code, we should remove the extensive use of code duplication (copy-paste).
Here is a gist showing some of the current duplication, automatically generated with PMD. Not all of these are meaningful duplications, but it catches many obvious repeats:
https://gist.github.com/GNiendorf/fd4fe952f38149b5bfd1269a7039370e
This was generated with the following:
1. Download PMD
wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F7.5.0/pmd-dist-7.5.0-bin.zip
2. Extract the PMD archive
unzip pmd-dist-7.5.0-bin.zip -d pmd-dist
3. Navigate to the PMD bin directory
cd pmd-dist/pmd-bin-7.5.0/bin
4. Create a list of .cc and .h files in specific directories
find
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/interface/alpaka
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/interface
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/src/alpaka
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/src
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/standalone/bin
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/standalone/code/core
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/standalone/efficiency/src
-type f ( -name ".cc" -o -name ".h" ) > file_list.txt
5. Run CPD to generate the duplication report
./pmd cpd --minimum-tokens 100 --file-list file_list.txt --language cpp --format text > duplication_report.txt