phpphpcs

ERROR: the "PHPCompatibility" coding standard is not installed


When I execute git commit, I get this error:

ERROR: the "PHPCompatibility" coding standard is not installed. The installed coding standards are MySource, PEAR, Zend, PSR2, PSR1, Squiz, PSR12, Drupal and DrupalPractice
Fix the PHPCompatibility error before commit please

Then I execute:

phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility

Executed git commit again; a new error appeared again:

ERROR: the "Drupal" coding standard is not installed. The installed coding standards are MySource, PEAR, Zend, PSR2, PSR1, Squiz and PSR12
Fix the Drupal Standard error before commit please

I executed the command again:

phpcs --config-set installed_paths vendor/drupal/coder/coder_sniffer

As a result, the original error appeared again:

the "PHPCompatibility" coding standard is not installed

What's wrong with my configuration?

enter image description here

enter image description here

enter image description here


Solution

  • I reinstalled php_codesniffer and drupal/coder, and executed the command:

     phpcs --config-set installed_paths /homeriverz/.config/composer/vendor/phpcompatibility/php-compatibility,/homeriverz/.config/composer/vendor/drupal/coder/coder_sniffer,/homeriverz/.config/composer/vendor/slevomat /coding-standard
    

    will run normally