以下の重複したコードは 2 つの異なるコントローラー ファイルに存在しますが、ping の実行時に build.xml のコピー ペースト ディテクターはそれを検出しません。生成されるレポート ファイルには、以下に示すように空のブロックしかありません。誰かが私に欠けているものを教えてもらえますか?
前もって感謝します
探知機の報告:
<?xml version="1.0" encoding="UTF-8"?>
<pmd-cpd/>
zzz@ubuntu:$ bin/phpcpd src/Foo/TeBundle/Controller/Create/LeController.php
phpcpd 2.0.1-5-ga7488a0 by Sebastian Bergmann.
0.00% duplicated lines out of 134 total lines of code.
Time: 25 ms, Memory: 3.00Mb
- コントローラ 1: src/Football/TeamBundle/Controller/Create/CountryController.php
- コントローラ 2: src/Football/TeamBundle/Controller/Create/CityController.php
重複コード:
public function indexAction()
{
$form = $this->getForm();
if (is_null($form)) {
echo 'form empty';
} else {
echo 'not empty';
}
}
public function indexAction()
{
$form = $this->getForm();
if (is_null($form)) {
echo 'form empty';
} else {
echo 'not empty';
}
}
ビルド.XML
<?xml version="1.0" encoding="UTF-8"?>
<project name="Sport" default="detect-copy-paste" basedir=".">
<!-- GLOBAL VARIABLES -->
<property name="dir-source" value="${project.basedir}/src" />
<property name="dir-report" value="test/report/phing" />
<!-- END -->
<!-- FILESET -->
<fileset id="sourcecode" dir="${dir-source}">
<include name="**/*.php" />
</fileset>
<!-- END -->
<!-- COPY and PASTE DETECTOR -->
<target name="detect-copy-paste" description="Checks similar code blocks.">
<echo msg="Checking similar code blocks ..." />
<phpcpd>
<fileset refid="sourcecode" />
<formatter type="pmd" outfile="${dir-report}/copypaste.xml" />
</phpcpd>
</target>
<!-- END -->
</project>
作曲家.JSON
{
"autoload": {
"psr-0": {
"": "src/",
"SymfonyStandard": "app/"
}
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"behat/behat": "2.5.*@stable",
"behat/behat-bundle": "1.0.0",
"behat/symfony2-extension": "1.1.2",
"behat/mink": "1.5.0",
"behat/mink-extension": "~1.3",
"behat/mink-selenium2-driver": "1.1.1",
"behat/mink-goutte-driver": "1.0.9",
"phing/phing": "2.8.2",
"squizlabs/php_codesniffer": "1.5.1",
"doctrine/doctrine-fixtures-bundle": "2.2.*",
"pdepend/pdepend": "2.0.*",
"phpmd/phpmd" : "2.0.*",
"sebastian/phpcpd": "@dev",
"sebastian/finder-facade": "~1.1",
"sebastian/version": "~1.0.3",
"symfony/console": "~2.2",
"phpunit/php-timer": "~1.0.4",
"theseer/fdomdocument": "~1.4"
}
}