box icon indicating copy to clipboard operation
box copied to clipboard

New workflow about Coding Standard

Open llaville opened this issue 4 years ago • 2 comments

Feature Request

You should think to add a new workflow (GH Actions) to check about Coding Standard violations.

As contributor, I've read how to start, and see the make cs command. With master branch and commit 78b88c4897973f897913c0501778fd08017039ec, with PHP 7.4, I've following results

composer bin php-cs-fixer install
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 29 installs, 0 updates, 0 removals
  - Locking composer/semver (3.2.6)
  - Locking composer/xdebug-handler (2.0.2)
  - Locking doctrine/annotations (1.13.2)
  - Locking doctrine/lexer (1.2.1)
  - Locking friendsofphp/php-cs-fixer (v3.3.2)
  - Locking php-cs-fixer/diff (v2.0.2)
  - Locking psr/cache (1.0.1)
  - Locking psr/container (1.1.2)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/log (1.1.4)
  - Locking symfony/console (v5.3.10)
  - Locking symfony/deprecation-contracts (v2.4.0)
  - Locking symfony/event-dispatcher (v5.3.7)
  - Locking symfony/event-dispatcher-contracts (v2.4.0)
  - Locking symfony/filesystem (v5.3.4)
  - Locking symfony/finder (v5.3.7)
  - Locking symfony/options-resolver (v5.3.7)
  - Locking symfony/polyfill-ctype (v1.23.0)
  - Locking symfony/polyfill-intl-grapheme (v1.23.1)
  - Locking symfony/polyfill-intl-normalizer (v1.23.0)
  - Locking symfony/polyfill-mbstring (v1.23.1)
  - Locking symfony/polyfill-php72 (v1.23.0)
  - Locking symfony/polyfill-php73 (v1.23.0)
  - Locking symfony/polyfill-php80 (v1.23.1)
  - Locking symfony/polyfill-php81 (v1.23.0)
  - Locking symfony/process (v5.3.7)
  - Locking symfony/service-contracts (v2.4.0)
  - Locking symfony/stopwatch (v5.3.4)
  - Locking symfony/string (v5.3.10)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 29 installs, 0 updates, 0 removals
  - Downloading doctrine/lexer (1.2.1)
  - Downloading symfony/stopwatch (v5.3.4)
  - Downloading symfony/process (v5.3.7)
  - Downloading symfony/polyfill-php72 (v1.23.0)
  - Downloading psr/event-dispatcher (1.0.0)
  - Downloading symfony/event-dispatcher-contracts (v2.4.0)
  - Downloading symfony/event-dispatcher (v5.3.7)
  - Downloading php-cs-fixer/diff (v2.0.2)
  - Downloading psr/cache (1.0.1)
  - Downloading doctrine/annotations (1.13.2)
  - Downloading composer/semver (3.2.6)
  - Downloading friendsofphp/php-cs-fixer (v3.3.2)
  - Installing doctrine/lexer (1.2.1): Extracting archive
  - Installing psr/container (1.1.2): Extracting archive
  - Installing symfony/service-contracts (v2.4.0): Extracting archive
  - Installing symfony/stopwatch (v5.3.4): Extracting archive
  - Installing symfony/polyfill-php80 (v1.23.1): Extracting archive
  - Installing symfony/process (v5.3.7): Extracting archive
  - Installing symfony/polyfill-php81 (v1.23.0): Extracting archive
  - Installing symfony/polyfill-php72 (v1.23.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.23.1): Extracting archive
  - Installing symfony/polyfill-php73 (v1.23.0): Extracting archive
  - Installing symfony/deprecation-contracts (v2.4.0): Extracting archive
  - Installing symfony/options-resolver (v5.3.7): Extracting archive
  - Installing symfony/finder (v5.3.7): Extracting archive
  - Installing symfony/polyfill-ctype (v1.23.0): Extracting archive
  - Installing symfony/filesystem (v5.3.4): Extracting archive
  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v2.4.0): Extracting archive
  - Installing symfony/event-dispatcher (v5.3.7): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.23.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.23.1): Extracting archive
  - Installing symfony/string (v5.3.10): Extracting archive
  - Installing symfony/console (v5.3.10): Extracting archive
  - Installing php-cs-fixer/diff (v2.0.2): Extracting archive
  - Installing psr/cache (1.0.1): Extracting archive
  - Installing doctrine/annotations (1.13.2): Extracting archive
  - Installing psr/log (1.1.4): Extracting archive
  - Installing composer/xdebug-handler (2.0.2): Extracting archive
  - Installing composer/semver (3.2.6): Extracting archive
  - Installing friendsofphp/php-cs-fixer (v3.3.2): Extracting archive
4 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
23 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
touch vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer
composer bin doctrine-cs install
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 5 installs, 0 updates, 0 removals
  - Locking dealerdirect/phpcodesniffer-composer-installer (v0.7.1)
  - Locking doctrine/coding-standard (6.0.1)
  - Locking phpstan/phpdoc-parser (0.3.5)
  - Locking slevomat/coding-standard (5.0.4)
  - Locking squizlabs/php_codesniffer (3.6.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 5 installs, 0 updates, 0 removals
  - Downloading squizlabs/php_codesniffer (3.6.1)
  - Downloading dealerdirect/phpcodesniffer-composer-installer (v0.7.1)
  - Downloading phpstan/phpdoc-parser (0.3.5)
  - Downloading slevomat/coding-standard (5.0.4)
  - Downloading doctrine/coding-standard (6.0.1)

  - Installing squizlabs/php_codesniffer (3.6.1): Extracting archive
  - Installing dealerdirect/phpcodesniffer-composer-installer (v0.7.1): Extracting archive
  - Installing phpstan/phpdoc-parser (0.3.5): Extracting archive
  - Installing slevomat/coding-standard (5.0.4): Extracting archive
  - Installing doctrine/coding-standard (6.0.1): Extracting archive
Generating autoload files
PHP CodeSniffer Config installed_paths set to ../../doctrine/coding-standard/lib,../../slevomat/coding-standard
touch vendor-bin/doctrine-cs/vendor/bin/phpcs
composer bin doctrine-cs install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating autoload files
touch vendor-bin/doctrine-cs/vendor/bin/phpcbf
php -d zend.enable_gc=0 vendor-bin/doctrine-cs/vendor/bin/phpcbf || true
............................................................ 60 / 67 (90%)
.......                                                      67 / 67 (100%)



No fixable errors were found

Time: 3.21 secs; Memory: 4MB

php -d zend.enable_gc=0 vendor-bin/doctrine-cs/vendor/bin/phpcs
............................................................ 60 / 67 (90%)
.......                                                      67 / 67 (100%)


Time: 3.34 secs; Memory: 6MB

php -d zend.enable_gc=0 vendor-bin/php-cs-fixer/vendor/bin/php-cs-fixer fix
Loaded config default from "/shared/backups/github/my-box/.php-cs-fixer.dist.php".
   1) src/Compactor/Php.php
   2) tests/RequirementChecker/RequirementsDumperTest.php
   3) tests/Compactor/PhpTest.php

Fixed all files in 34.586 seconds, 26.000 MB memory used

llaville avatar Nov 17 '21 08:11 llaville

I'm happy to have a new workflow to check the CS but what kinda putted me off from doing so was the fact that there is no easy way to pass additional flags to PHP-CS-Fixer for example. Because locally with the Makefile I want a fix, not a lint. And I don't really want to add too much CI custom things and rely as much as possible on the Makefile

theofidry avatar Feb 14 '22 10:02 theofidry

I've an idea to fix such situation, but it can take time ... I'll work on it later

llaville avatar Feb 14 '22 11:02 llaville

Done via #598

theofidry avatar Feb 03 '23 22:02 theofidry