From 87bd720d6ec930cc672d92e0892abe6b781c0cd4 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 21 Feb 2022 17:13:53 +0100 Subject: [PATCH] Switch to phpcq dev-2.0 --- .composer-require-checker.json | 6 +- .github/workflows/diagnostics.yml | 73 +++++++++++++++++------- .gitignore | 3 + .phpcq.lock | 1 + composer.json | 61 ++++++++++---------- phpcq.yaml.dist | 93 +++++++++++++++++++++++++++++++ phpcs.xml.dist | 4 ++ 7 files changed, 189 insertions(+), 52 deletions(-) create mode 100644 .phpcq.lock create mode 100644 phpcq.yaml.dist create mode 100644 phpcs.xml.dist diff --git a/.composer-require-checker.json b/.composer-require-checker.json index 9efb696..bb82cb7 100644 --- a/.composer-require-checker.json +++ b/.composer-require-checker.json @@ -6,6 +6,10 @@ "array_insert", "Contao\\ManagerPlugin\\Bundle\\BundlePluginInterface", "Contao\\ManagerPlugin\\Bundle\\Config\\BundleConfig", - "Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface" + "Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface", + "Contao\\ManagerPlugin\\Routing\\RoutingPluginInterface", + "Hofff\\Contao\\Consent\\Bridge\\Bridge", + "Hofff\\Contao\\Consent\\Bridge\\Plugin", + "Hofff\\Contao\\Consent\\Bridge\\Render\\RenderInformation" ] } diff --git a/.github/workflows/diagnostics.yml b/.github/workflows/diagnostics.yml index bf92fed..3c315bb 100644 --- a/.github/workflows/diagnostics.yml +++ b/.github/workflows/diagnostics.yml @@ -1,49 +1,82 @@ -name: netzmacht/contao-leaflet-maps +name: Code Quality Diagnostics on: - push: pull_request: + push: + branches: + - master jobs: build: runs-on: ubuntu-latest + + name: PHP ${{ matrix.php }} + strategy: + fail-fast: false matrix: - php: [7.3, 7.4] - contao: [~4.9.0, ~4.13.0] + include: + - php: 7.4 + output: '-o github-action -o default' + phpcq_install: 'install' + - php: 8.0 + output: '-o default' + phpcq_install: 'update' + - php: 8.1 + output: '-o default' + phpcq_install: 'update' + - php: 8.2 + output: '-o default' + phpcq_install: 'update' steps: - - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Pull source + - name: Pull source uses: actions/checkout@v2 - with: - fetch-depth: 0 - # see https://github.com/shivammathur/setup-php - - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Setup PHP. + - name: Setup PHP with PECL extension uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - coverage: none - - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Cache composer cache directory + - name: Cache composer cache directory uses: actions/cache@v1 env: cache-name: composer-cache-dir with: path: ~/.cache/composer - key: ${{ runner.os }}-build-${{ env.cache-name }} + key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }} - - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Cache vendor directory + - name: Cache vendor directory uses: actions/cache@v1 env: - cache-name: composer-vendor + cache-name: vendor with: path: vendor - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Install composer dependencies - run: composer update --prefer-dist --no-interaction --no-suggest + ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}- - - name: PHP ${{ matrix.php }} ${{ matrix.contao }} Run tests - run: ant -keep-going + - name: Cache phpcq directory + uses: actions/cache@v1 + env: + cache-name: phpcq + with: + path: .phpcq + key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/.phpcq.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}- + + - name: Install composer dependencies + run: composer install + - name: Install phpcq toolchain + run: ./vendor/bin/phpcq ${{ matrix.phpcq_install }} -v + + - name: Run tests + run: ./vendor/bin/phpcq run -v ${{ matrix.output }} + + - name: Upload build directory to artifact + uses: actions/upload-artifact@v2 + if: ${{ success() }} || ${{ failure() }} + with: + name: phpcq-builds-php-${{ matrix.php }} + path: .phpcq/build/ diff --git a/.gitignore b/.gitignore index 03ab70b..f829879 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ build.properties # NPM node_modules + +.phpcq +phpcq.yaml diff --git a/.phpcq.lock b/.phpcq.lock new file mode 100644 index 0000000..374a665 --- /dev/null +++ b/.phpcq.lock @@ -0,0 +1 @@ +{"plugins":{"composer-require-checker":{"api-version":"1.0.0","version":"1.0.1.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-require-checker-1.0.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8"}},"checksum":{"type":"sha-512","value":"5b0fd8cd5e0f5761c53b9d5375b6f6ba50f148468896248f823cc2a48361adfd872556066764b1b544ff51ffd5de60d6f9a75050db00b257d807976ac761bc3a"},"tools":{"composer-require-checker":{"version":"3.8.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar","requirements":{"php":{"php":"^7.4 || ^8.0","ext-json":"*","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar.asc"}}},"phpmd":{"api-version":"1.0.0","version":"1.0.1.0","type":"php-file","url":"https://phpcq.github.io/repository/phpmd-1.0.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"88e267b9c36b2edc85e924717606b626e005ac8d97b1f65f5331e2a3b3894dec2cf124f6187541bf759d026477b6d94daacc5d5c81bb09714a68ffabe5698dc5"},"tools":{"phpmd":{"version":"2.11.1","url":"https://github.com/phpmd/phpmd/releases/download/2.11.1/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":null}}},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}}},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}}},"phpcs":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/phpcs-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"2737022369da1318cc4e0ea194e8a81019f7b079080d869aab878b7486052fdbe68fee3f28131f35573226def1aabd4bd005e038ee7b767c137b1107c1492a83"},"tools":{"phpcs":{"version":"3.6.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcs.phar.asc"},"phpcbf":{"version":"3.6.2","url":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-tokenizer":"*","ext-xmlwriter":"*","ext-simplexml":"*"}},"checksum":null,"signature":"https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.6.2/phpcbf.phar.asc"}}},"composer-normalize":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/composer-normalize-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d59d3557cb20630734878a9115df5dd32d5aff815e5b15be36f6fb5d6e9d83dd36efd84215ab6529edcc924f600946f739a0d9e67723deff95c88346ab502498"},"tools":{"composer-normalize":{"version":"2.23.1","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.23.1/composer-normalize.phar","requirements":{"php":{"php":"^7.4 || ^8.0"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.23.1/composer-normalize.phar.asc"}}}},"tools":[]} \ No newline at end of file diff --git a/composer.json b/composer.json index d7b9517..83af883 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,13 @@ { "name": "netzmacht/contao-leaflet-maps", - "type": "contao-bundle", "description": "Contao Leaflet maps integration", + "license": "LGPL-3.0-or-later", + "type": "contao-bundle", "keywords": [ "contao", "maps", "leaflet" ], - "license": "LGPL-3.0-or-later", "authors": [ { "name": "David Molineus", @@ -16,6 +16,12 @@ "role": "Developer" } ], + "support": { + "email": "mail@netzmacht.de", + "issues": "https://github.com/netzmacht/contao-leaflet-maps/issues", + "source": "https://github.com/netzmacht/contao-leaflet-maps", + "docs": "http://leaflet-maps-for-contao.readthedocs.org/" + }, "require": { "php": ">=7.1", "ext-json": "*", @@ -36,56 +42,49 @@ "symfony/event-dispatcher": "~4.4 || ^5.1", "symfony/event-dispatcher-contracts": "^1.1 || ^2.0", "symfony/filesystem": "~4.4 || ^5.1", + "symfony/http-foundation": "~4.4 || ^5.1", "symfony/http-kernel": "~4.4 || ^5.1", - "symfony/twig-bundle": "~4.4 || ^5.1", + "symfony/routing": "~4.4 || ^5.1", + "symfony/templating": "~4.4 || ^5.1", "symfony/translation": "~4.4 || ^5.1", + "symfony/twig-bundle": "~4.4 || ^5.1", "twig/twig": "^2.0 || ^3.0" }, "require-dev": { "contao/manager-plugin": "^2.1", "hofff/contao-consent-bridge": "^1.0", - "phpcq/all-tasks": "^1.2" + "phpcq/coding-standard": "^2.1", + "phpcq/runner-bootstrap": "^1.0@dev" }, "conflict": { "hofff/contao-consent-bridge": "<1.0 || >= 2.0" }, - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev", - "dev-develop": "3.3.x-dev", - "dev-support/2.x": "2.0.x-dev" - }, - "contao": { - "transifex": { - "project": "contao-leaflet-maps", - "prefix": "core-", - "languages_cto": "src/Bundle/Resources/contao/languages", - "languages_tx": ".tx" - } - }, - "contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin" - }, "autoload": { "psr-4": { "Netzmacht\\Contao\\Leaflet\\": "src/" } }, - "autoload-dev": { - "files": [ - "vendor/phpcq/autoload-validation/hacks/contao-hack.php" - ] - }, - "support": { - "email": "mail@netzmacht.de", - "issues": "https://github.com/netzmacht/contao-leaflet-maps/issues", - "source": "https://github.com/netzmacht/contao-leaflet-maps", - "docs": "http://leaflet-maps-for-contao.readthedocs.org/" - }, "config": { "allow-plugins": { "contao-components/installer": true, "contao/manager-plugin": true, "contao-community-alliance/composer-plugin": true } + }, + "extra": { + "branch-alias": { + "dev-develop": "3.3.x-dev", + "dev-master": "3.2.x-dev", + "dev-support/2.x": "2.0.x-dev" + }, + "contao": { + "transifex": { + "languages_cto": "src/Bundle/Resources/contao/languages", + "languages_tx": ".tx", + "prefix": "core-", + "project": "contao-leaflet-maps" + } + }, + "contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin" } } diff --git a/phpcq.yaml.dist b/phpcq.yaml.dist new file mode 100644 index 0000000..c7a5099 --- /dev/null +++ b/phpcq.yaml.dist @@ -0,0 +1,93 @@ +phpcq: + repositories: + - https://phpcq.github.io/repository/repository.json + directories: + - src + + plugins: + composer-require-checker: + version: ^1.0 + signed: false + phpmd: + version: ^1.0 + signed: false + requirements: + phpmd: + signed: false + phpcpd: + version: ^1.1 + signed: false + phploc: + version: ^1.0 + signed: false + phpcs: + version: ^1.0 + signed: false + composer-normalize: + version: ^1.0 + signed: false + + trusted-keys: + # composer require checker + - 033E5F8D801A2F8D + # sb@sebastian-bergmann.de + - 4AA394086372C20A + # magl@magll.net + - D2CCAC42F6295E7D + # PHP_CodeSniffer + - 31C7E470E2138192 + # Composer normalize + - C00543248C87FB13 + # phpmd + - 0F9684B8B16B7AB0 + +tasks: + fix: + - composer-normalize-fix + - phpcbf + + verify: + - composer-require-checker + - composer-normalize + + analyze: + - phploc + - phpcpd + - phpmd + - phpcs + + default: + - verify + - analyze + + phpcpd: + plugin: phpcpd + + phpmd: + config: + ruleset: + - vendor/phpcq/coding-standard/phpmd/ruleset.xml + + composer-require-checker: + plugin: composer-require-checker + config: + config_file: '.composer-require-checker.json' + + phpcs: + plugin: phpcs + config: &phpcs-config + standard: ~ + excluded: + - src/Bundle/Resources/contao/languages + - src/Bundle/Resources/public/js + + phpcbf: + plugin: phpcs + config: + <<: *phpcs-config + fix: true + + composer-normalize-fix: + plugin: composer-normalize + config: + dry_run: false diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..1d91d20 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,4 @@ + + + +