From ddecb3009f7ba1608f8d4d7b3d73cf0913cb5e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Uzna=C5=84ski?= Date: Sat, 21 Nov 2020 18:21:09 +0100 Subject: [PATCH] [FEATURE] Add phpcpd (#149) Resolves: #129 --- .github/workflows/ci.yml | 1 + .gitlab/pipeline/.gitlab-ci.yml | 10 ++++++++++ README.md | 6 +++++- composer.json | 4 +++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b26b6ba..de98803 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,7 @@ jobs: - "json:lint" - "php:sniff" - "php:codestyle" + - "php:copypaste" php-version: - 7.4 code-quality-frontend: diff --git a/.gitlab/pipeline/.gitlab-ci.yml b/.gitlab/pipeline/.gitlab-ci.yml index 5b9a17a..f9b9e10 100644 --- a/.gitlab/pipeline/.gitlab-ci.yml +++ b/.gitlab/pipeline/.gitlab-ci.yml @@ -261,3 +261,13 @@ phpcs: - php-lint-php7.4 script: - composer ci:php:sniff + +php-copypaste-check: + stage: codestyle + needs: + - build-composer-dependencies + - php-lint-php7.2 + - php-lint-php7.3 + - php-lint-php7.4 + script: + - composer ci:php:copypaste diff --git a/README.md b/README.md index 0135467..6c699a8 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,14 @@ All of those checks are available in Github Actions and in Gitlab CI. `composer ci:php:codestyle` -### PHP Sniff by phpcs [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) +### PHP Sniff by [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) `composer ci:php:sniff` +### PHP Copypaste check by [phpcpd](https://github.com/sebastianbergmann/phpcpd) + +`composer ci:php:copypaste` + ### JSON Lint check by [jsonlint](https://github.com/Seldaek/jsonlint) `composer ci:json:lint` diff --git a/composer.json b/composer.json index 360cdc2..58e023d 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,8 @@ "typo3/cms-fluid-styled-content": "^9.5 || ^10.4", "seld/jsonlint": "^1.8", "phpdocumentor/reflection-docblock": "<= 5.1 || > 5.2", - "j13k/yaml-lint": "1.1.x-dev" + "j13k/yaml-lint": "1.1.x-dev", + "sebastian/phpcpd": "^4.1.0" }, "replace": { "typo3-ter/tea": "self.version" @@ -69,6 +70,7 @@ "ci:php:lint": "find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l", "ci:php:codestyle": "php-cs-fixer fix --config .php_cs.php -v --dry-run --using-cache false --diff --diff-format=udiff", "ci:php:sniff": ".Build/vendor/bin/phpcs Classes Configuration Tests", + "ci:php:copypaste": ".Build/vendor/bin/phpcpd Classes Configuration Tests", "ci:json:lint": "find . ! -path '*.Build/*' -name '*.json' | xargs .Build/vendor/bin/jsonlint -q", "ci:yaml:lint": "find . ! -path '*.Build/*' -name '*.yml' | xargs .Build/vendor/bin/yaml-lint", "ci:ts:lint": ".Build/vendor/bin/typoscript-lint -c Configuration/TsLint.yml --ansi -n --fail-on-warnings -vvv Configuration/TypoScript",