php-censor / php-censor

PHP Censor is an open source self-hosted continuous integration server for PHP projects.

Home Page:http://php-censor.info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] PHP Copy/Paste Detector Unknown option "--names-exclude"

kromonos opened this issue · comments

Expected behavior

A lot of output

Actual behavior

RUNNING PLUGIN: PHP Copy/Paste Detector (Stage: Test)
Shell command: cd "<BUILD_PATH>/" && <PHP_CENSOR_PATH>/vendor/bin/phpcpd --log-pmd "/tmp/php_cpd_Bd87NN"  --exclude="vendor" --exclude="tests" --exclude="system/src/Grav" --exclude="user/plugins" --exclude="cache" --names-exclude="disastrous.php,install.php,matomo.php,PiwikTracker.php,index.php,shields_config.dist.php,router.php" "<BUILD_PATH>/"
phpcpd 6.0.3 by Sebastian Bergmann.
Unknown option "--names-exclude"

Exception: Could not process the report generated by PHPCpd.
PLUGIN: FAILED (ALLOWED)

Steps to reproduce

Add following to your .php-censor.yml

build_settings:
  ignore:
    - disastrous.php
    - url/inc/matomo.php
    - url/inc/PiwikTracker.php
    - user/themes/teleyal/teleyal.php
    - /index.php
    - shields_config.dist.php
    - system/router.php

test:
  php_cpd:
    allow_failures: true

Environment

  • PHP Censor version: 2.0.0
  • Operating System: Debian 10
  • PHP version: 7.4
  • MySQL/PostgreSQL version: 5.7.22
vendor/bin$ ./phpcpd --help
phpcpd 6.0.3 by Sebastian Bergmann.

Usage:
  phpcpd [options] <directory>

Options for selecting files:

  --suffix <suffix> Include files with names ending in <suffix> in the analysis
                    (default: .php; can be given multiple times)
  --exclude <path>  Exclude files with <path> in their path from the analysis
                    (can be given multiple times)

Options for analysing files:

  --fuzzy           Fuzz variable names
  --min-lines <N>   Minimum number of identical lines (default: 5)
  --min-tokens <N>  Minimum number of identical tokens (default: 70)

Options for report generation:

  --log-pmd <file>  Write log in PMD-CPD XML format to <file>

@kromonos Thanks! I try to fix it soon. For now you may use workaround: change --names-exclude to --exclude in the plugin source code.

Fixed in branches: release-1.3, release-2.0 and master and will be released with versions 1.3.1 and 2.0.1. @kromonos Could you test fix on your installation please?

Works as expected 👍 Thank you :)