PHPで冗長化したコードを検出できるPHPCPDを使ってEC-CUBEのコミッターをするよ

NO IMAGE

以前、Jenkinsを使う際に導入したPHPCPD
EC-CUBEのコミッターをするにあたってまずはこれを潰しちゃおうと思ってかけてみました

~~~
$ phpcpd ./eccube-2.11.0-beta/
phpcpd 1.3.2 by Sebastian Bergmann.

Found 31 exact clones with 761 duplicated lines in 39 files:

– data/module/Compat/Compat/Function/_sha256.php:14-133
data/module/Compat/Compat/Function/sha256.php:14-133

– data/module/Calendar/tests/week_test.php:38-49
data/module/Calendar/tests/day_test.php:27-38

– data/module/Calendar/tests/decorator_test.php:19-35
data/module/Calendar/tests/util_textual_test.php:15-31

– data/module/Calendar/tests/week_test.php:36-49
data/module/Calendar/tests/month_weekdays_test.php:34-47

– data/module/Calendar/tests/month_weekdays_test.php:25-47
data/module/Calendar/tests/year_test.php:51-73

– data/module/Calendar/tests/unixts_engine_test.php:15-47
data/module/Calendar/tests/peardate_engine_test.php:15-47

– data/module/Calendar/tests/month_weekdays_test.php:16-50
data/module/Calendar/tests/month_test.php:19-53

– data/module/Calendar/tests/week_test.php:14-58
data/module/Calendar/tests/week_firstday_0_test.php:14-58

– data/module/Calendar/tests/week_test.php:74-111
data/module/Calendar/tests/week_firstday_0_test.php:74-111

– data/module/Calendar/tests/month_weekdays_test.php:14-50
data/module/Calendar/tests/month_weeks_test.php:14-50

– data/module/Calendar/docs/examples/1.php:13-37
data/module/Calendar/docs/examples/13.php:16-40

– data/module/Calendar/docs/examples/1.php:54-78
data/module/Calendar/docs/examples/13.php:61-85

– data/module/MDB2/Driver/pgsql.php:1164-1190
data/module/MDB2/Driver/mysql.php:1374-1400

– data/module/MDB2/Driver/pgsql.php:1390-1407
data/module/MDB2/Driver/mysql.php:1580-1597

– data/module/MDB2/Driver/pgsql.php:1474-1487
data/module/MDB2/Driver/mysql.php:1654-1667

– data/module/fpdf/font/helveticabi.php:2-14
data/module/fpdf/font/helvetica.php:2-14

– data/module/fpdf/font/helveticabi.php:2-14
data/module/fpdf/font/helveticab.php:2-14

– data/module/fpdf/fpdi.php:336-348
data/module/fpdf/fpdf_tpl.php:391-403

– data/module/Tar.php:1042-1050
data/module/Tar.php:1116-1124

– data/module/Tar.php:1041-1048
data/module/Tar.php:1172-1179

– data/module/MDB2/Driver/mysql.php:1048-1056
data/module/MDB2.php:2939-2947

– data/class/util/SC_Utils.php:1719-1736
data/class/helper/SC_Helper_FileManager.php:240-257

– data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php:768-804
data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php:901-937

– data/class/pages/admin/products/LC_Page_Admin_Products_Review.php:65-76
data/class/pages/admin/products/LC_Page_Admin_Products_Trackback.php:63-74

– data/class/pages/admin/products/LC_Page_Admin_Products_Review.php:198-217
data/class/pages/admin/products/LC_Page_Admin_Products_Trackback.php:174-193

– data/class/pages/admin/contents/LC_Page_Admin_Contents_RecommendSearch.php:113-119
data/class/pages/admin/products/LC_Page_Admin_Products_ProductSelect.php:118-124

– data/class/pages/admin/customer/LC_Page_Admin_Customer_Customer.php:82-107
data/class/pages/admin/customer/LC_Page_Admin_Customer_Edit.php:84-109

– data/class/pages/admin/customer/LC_Page_Admin_Customer_Customer.php:202-262
data/class/pages/admin/customer/LC_Page_Admin_Customer_Edit.php:221-281

– data/class/pages/mypage/LC_Page_Mypage_Change.php:178-205
data/class/pages/entry/LC_Page_Entry.php:79-106

– data/module/Smarty/libs/plugins/function.html_radios.php:57-77
data/smarty_extends/function.html_radios_ex.php:60-80

– data/module/Smarty/libs/plugins/function.html_checkboxes.php:63-76
data/smarty_extends/function.html_checkboxes_ex.php:68-81

0.45% duplicated lines out of 168156 total lines of code.

Time: 46 seconds, Memory: 126.25Mb
~~~

あら、以前かけた時より圧倒的に減ってる気がするゾ
まずは管理画面の修正が出来そうなのでJenkins+phpcpdで自分を監視しながらやっていこうと思います