Fix the issues reported by phpcs

Created on 10 June 2022, about 2 years ago
Updated 6 March 2024, 4 months ago

phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml href_lang_exchange/ return the following report.

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\href_lang_exchange\css\different\node_modules\flag-icon-css\README.md
----------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 16 WARNINGS AFFECTING 16 LINES
----------------------------------------------------------------------------------------------------------------------------
   3 | WARNING | Line exceeds 80 characters; contains 81 characters
  29 | WARNING | Line exceeds 80 characters; contains 81 characters
  39 | WARNING | Line exceeds 80 characters; contains 81 characters
  40 | WARNING | Line exceeds 80 characters; contains 81 characters
  81 | WARNING | Line exceeds 80 characters; contains 159 characters
  89 | WARNING | Line exceeds 80 characters; contains 117 characters
  95 | WARNING | Line exceeds 80 characters; contains 140 characters
  96 | WARNING | Line exceeds 80 characters; contains 140 characters
  97 | WARNING | Line exceeds 80 characters; contains 140 characters
  98 | WARNING | Line exceeds 80 characters; contains 140 characters
  99 | WARNING | Line exceeds 80 characters; contains 140 characters
 100 | WARNING | Line exceeds 80 characters; contains 140 characters
 101 | WARNING | Line exceeds 80 characters; contains 140 characters
 102 | WARNING | Line exceeds 80 characters; contains 140 characters
 103 | WARNING | Line exceeds 80 characters; contains 140 characters
 104 | WARNING | Line exceeds 80 characters; contains 140 characters
----------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\contribution\web\modules\contrib\href_lang_exchange\css\different\node_modules\opencollective-postinstall\README.md
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
  3 | WARNING | Line exceeds 80 characters; contains 81 characters
 28 | WARNING | Line exceeds 80 characters; contains 144 characters
 30 | WARNING | Line exceeds 80 characters; contains 119 characters
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\contribution\web\modules\contrib\href_lang_exchange\modules\href_lang_exchange_country_override\src\SiteEntityMultiRegionExtensionStorage.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
 15 | WARNING | [x] '@todo: Check if this class is used.' should match the format '@todo Fix problem X here.'
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\contribution\web\modules\contrib\href_lang_exchange\modules\href_lang_exchange_href\href_lang_exchange_href.install
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
 8 | WARNING | [x] Unused use statement
-----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\contribution\web\modules\contrib\href_lang_exchange\modules\href_lang_exchange_href\src\Form\SiteEntityDeleteForm.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
 58 | ERROR | [x] Expected 1 blank line after function; 0 found
 59 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\contribution\web\modules\contrib\href_lang_exchange\README.md
-----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 16 WARNINGS AFFECTING 16 LINES
-----------------------------------------------------------------------------------
  39 | WARNING | Line exceeds 80 characters; contains 85 characters
  43 | WARNING | Line exceeds 80 characters; contains 126 characters
  44 | WARNING | Line exceeds 80 characters; contains 109 characters
  46 | WARNING | Line exceeds 80 characters; contains 100 characters
  47 | WARNING | Line exceeds 80 characters; contains 91 characters
  48 | WARNING | Line exceeds 80 characters; contains 99 characters
  53 | WARNING | Line exceeds 80 characters; contains 90 characters
 121 | WARNING | Line exceeds 80 characters; contains 89 characters
 123 | WARNING | Line exceeds 80 characters; contains 92 characters
 131 | WARNING | Line exceeds 80 characters; contains 120 characters
 141 | WARNING | Line exceeds 80 characters; contains 115 characters
 169 | WARNING | Line exceeds 80 characters; contains 90 characters
 170 | WARNING | Line exceeds 80 characters; contains 83 characters
 172 | WARNING | Line exceeds 80 characters; contains 113 characters
 186 | WARNING | Line exceeds 80 characters; contains 86 characters
 193 | WARNING | Line exceeds 80 characters; contains 95 characters
-----------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\contribution\web\modules\contrib\href_lang_exchange\src\Plugin\Field\FieldWidget\HrefLangExchangeFieldItemAutocompleteWidget.php
------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------
 232 | WARNING | Only string literals should be passed to t() where possible
 240 | WARNING | Only string literals should be passed to t() where possible
------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\contribution\web\modules\contrib\href_lang_exchange\tests\src\Unit\EventSubscriber\LazyHrefItemSubscriberTest.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------
 138 | ERROR | Doc comment is empty
---------------------------------------------------------------------------------------------------------------------------------------

Time: 2.01 secs; Memory: 22MB

All those issues need to be fixed.

📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

🇮🇳India Rakhi Soni

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The patch in comment #14 is not complete.

  • 🇮🇳India kkalashnikov Ghaziabad, India

    PHPCS and PHPSTAN fixes.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India kkalashnikov Ghaziabad, India
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    • The content of the css/different/node_modules/flag-icon-css and css/different/node_modules/opencollective-postinstall directories should not be touched, since they are coming for third-part repositories
    • The SiteEntityMultiRegionExtensionStorage.php, SiteEntityDeleteForm.php, HrefLangExchangeFieldItemAutocompleteWidget.php, and LazyHrefItemSubscriberTest.php files have not been changed
    • This issue is about what reported by phpcs, not PHPSTAN; patches and MRs for this issue should fix what reported in the issue summary
  • Status changed to Needs work about 1 year ago
  • Status changed to Needs review 9 months ago
  • 🇮🇳India Preethy_ray

    Hi,
    The above patch applied cleanly, but I found a few PHPCS errors and warnings. I have addressed those errors and warnings in the updated patch

  • Hi,
    Applied #23 patch. The patch applied cleanly without any errors and ran the command phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml href_lang_exchange/
    Didn't find any phpcs errors.

  • 🇮🇳India Yashaswi18

    Tried applying the patch provided in #23. Applies cleanly.

    Checking patch href_lang_exchange.module...
    Checking patch modules/href_lang_exchange_autoupdater/href_lang_exchange_autoupdater.module...
    Checking patch modules/href_lang_exchange_country_override/href_lang_exchange_country_override.module...
    Checking patch modules/href_lang_exchange_custom_logos/href_lang_exchange_custom_logos.module...
    Checking patch modules/href_lang_exchange_custom_logos/src/Controller/MultisiteLogosController.php...
    Checking patch modules/href_lang_exchange_href/src/Authentication/Provider/BasicTokenAuth.php...
    Checking patch modules/href_lang_exchange_href/src/Entity/SiteEntity.php...
    Checking patch modules/href_lang_exchange_href/src/Entity/SiteEntityInterface.php...
    Checking patch modules/href_lang_exchange_href/src/SiteEntityAccessControlHandler.php...
    Checking patch src/Connection/Connection.php...
    Checking patch src/Controller/JSONAPIEntityAutocompleteController.php...
    Checking patch src/Entity/HrefLangItem.php...
    Checking patch src/EventSubscriber/LazyHrefItemSubscriber.php...
    Checking patch src/HrefLangItemInterface.php...
    Checking patch src/Plugin/Block/HrefLanguageConnectionCountBlock.php...
    Checking patch src/Plugin/Block/HrefLanguageSwitchBlock.php...
    Checking patch src/Plugin/Field/FieldFormatter/HrefLangExchangeFieldItemFormatter.php...
    Checking patch src/Plugin/QueueWorker/HrefLangUpdateQueue.php...
    Checking patch src/Service/HrefLangItemValidator.php...
    Checking patch tests/src/Unit/Connection/ConnectionTest.php...
    Applied patch href_lang_exchange.module cleanly.
    Applied patch modules/href_lang_exchange_autoupdater/href_lang_exchange_autoupdater.module cleanly.
    Applied patch modules/href_lang_exchange_country_override/href_lang_exchange_country_override.module cleanly.
    Applied patch modules/href_lang_exchange_custom_logos/href_lang_exchange_custom_logos.module cleanly.
    Applied patch modules/href_lang_exchange_custom_logos/src/Controller/MultisiteLogosController.php cleanly.
    Applied patch modules/href_lang_exchange_href/src/Authentication/Provider/BasicTokenAuth.php cleanly.
    Applied patch modules/href_lang_exchange_href/src/Entity/SiteEntity.php cleanly.
    Applied patch modules/href_lang_exchange_href/src/Entity/SiteEntityInterface.php cleanly.
    Applied patch modules/href_lang_exchange_href/src/SiteEntityAccessControlHandler.php cleanly.
    Applied patch src/Connection/Connection.php cleanly.
    Applied patch src/Controller/JSONAPIEntityAutocompleteController.php cleanly.
    Applied patch src/Entity/HrefLangItem.php cleanly.
    Applied patch src/EventSubscriber/LazyHrefItemSubscriber.php cleanly.
    Applied patch src/HrefLangItemInterface.php cleanly.
    Applied patch src/Plugin/Block/HrefLanguageConnectionCountBlock.php cleanly.
    Applied patch src/Plugin/Block/HrefLanguageSwitchBlock.php cleanly.
    Applied patch src/Plugin/Field/FieldFormatter/HrefLangExchangeFieldItemFormatter.php cleanly.
    Applied patch src/Plugin/QueueWorker/HrefLangUpdateQueue.php cleanly.
    Applied patch src/Service/HrefLangItemValidator.php cleanly.
    Applied patch tests/src/Unit/Connection/ConnectionTest.php cleanly.

    Ran the command phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml href_lang_exchange/, found no errors remaining.

  • Status changed to RTBC 4 months ago
  • Status changed to Needs work 4 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -function __handle_multisite_creation(EntityInterface $entity, array $region, LazyStoreInterface $lazy_store, &$entities) {
    +function href_lang_exchange_country_override_handle_multisite_creation(EntityInterface $entity, array $region, LazyStoreInterface $lazy_store, &$entities) {

    The first underscore at the beginning of the function name cannot be removed, since it is used to mean the function is not part of the public API the module exposes.

    -function load_all() {
    +function href_lang_exchange_autoupdater_load_all() {

    While the new function name is the correct one, the change is not backward compatible.
    At least, any call to that function in the modules part of this project should be corrected. That does not avoid any issue with other modules that depend on the module defining load_all().

Production build 0.69.0 2024