2

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

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

I understand your pre-commit hook launches a linter that requires both standards to be installed simultaneously:

phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility,vendor/drupal/coder/coder_sniffer

Reference

2 Comments

Thanks a lot for your help, I executed the command: phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility,vendor/drupal/coder/coder_sniffer Refer to the link you gave to configure, but still report an error when executing git commit: ERROR: the "Drupal" coding standard is not installed. The installed coding standards are MySource, PEAR, Zend, PSR2, PSR1, Squiz and PSR12 Is it my configuration problem? Or the installation of drupal coder? Or is it a version issue?
What file contains the Drupal standard?
0

In my case I have forgotten to install the package :-)

composer require phpcompatibility/php-compatibility --dev

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.