Fix coding standards on branch 3.x before an official release

Created on 21 February 2023, over 1 year ago
Updated 14 August 2023, 11 months ago

Problem/Motivation

Make a Drupal stable module based on https://github.com/oneall/social-login-drupal

Proposed resolution

Solve the following coding standard:

wodby@php.container:/var/www/html $ phpcs --standard=Drupal,DrupalPractice web/modules/contrib/social_login/

FILE: /var/www/html/docroot/modules/contrib/social_login/src/Event/SocialLoginUserLinkedEvent.php
------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------
 23 | ERROR | Missing @var tag in member variable comment
 24 | ERROR | Class property $social_network_profile_data should use lowerCamel naming without
    |       | underscores
 37 | ERROR | Public method name "SocialLoginUserLinkedEvent::set_social_network_profile_data" is not
    |       | in lowerCamel format
 44 | ERROR | Public method name "SocialLoginUserLinkedEvent::get_social_network_profile_data" is not
    |       | in lowerCamel format
 51 | ERROR | Public method name "SocialLoginUserLinkedEvent::set_account" is not in lowerCamel
    |       | format
 58 | ERROR | Public method name "SocialLoginUserLinkedEvent::get_account" is not in lowerCamel
    |       | format
------------------------------------------------------------------------------------------------------


FILE: /var/www/html/docroot/modules/contrib/social_login/src/Event/SocialLoginUserLoginEvent.php
------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------
 24 | ERROR | Class property $social_network_profile_data should use lowerCamel naming without
    |       | underscores
 37 | ERROR | Public method name "SocialLoginUserLoginEvent::set_social_network_profile_data" is not
    |       | in lowerCamel format
 44 | ERROR | Public method name "SocialLoginUserLoginEvent::get_social_network_profile_data" is not
    |       | in lowerCamel format
 51 | ERROR | Public method name "SocialLoginUserLoginEvent::set_account" is not in lowerCamel format
 58 | ERROR | Public method name "SocialLoginUserLoginEvent::get_account" is not in lowerCamel format
------------------------------------------------------------------------------------------------------


FILE: /var/www/html/docroot/modules/contrib/social_login/src/Event/SocialLoginUserCreatedEvent.php
------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------
 23 | ERROR | Class property $social_network_profile_data should use lowerCamel naming without
    |       | underscores
 36 | ERROR | Public method name "SocialLoginUserCreatedEvent::set_social_network_profile_data" is
    |       | not in lowerCamel format
 43 | ERROR | Public method name "SocialLoginUserCreatedEvent::get_social_network_profile_data" is
    |       | not in lowerCamel format
 50 | ERROR | Public method name "SocialLoginUserCreatedEvent::set_account" is not in lowerCamel
    |       | format
 57 | ERROR | Public method name "SocialLoginUserCreatedEvent::get_account" is not in lowerCamel
    |       | format
------------------------------------------------------------------------------------------------------


FILE: /var/www/html/docroot/modules/contrib/social_login/src/Plugin/Block/SocialLoginBlock.php
----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
 43 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------


FILE: /var/www/html/docroot/modules/contrib/social_login/src/Form/SocialLoginBlock.php
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------
 39 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 80 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------


FILE: /var/www/html/docroot/modules/contrib/social_login/src/Form/SocialLoginAdminSettings.php
------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------
 464 | ERROR   | The array declaration extends to column 124 (the limit is 80). The array content
     |         | should be split up over multiple lines
 470 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------


FILE: /var/www/html/docroot/modules/contrib/social_login/src/Controller/SocialLoginController.php
------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 25 WARNINGS AFFECTING 36 LINES
------------------------------------------------------------------------------------------------------
  47 | ERROR   | The $_POST super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->request instead
  47 | ERROR   | The $_POST super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->request->get('connection_token')
     |         | instead
  47 | ERROR   | The $_POST super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->request->get('oa_action') instead
  47 | ERROR   | The $_POST super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->request->get('oa_action') instead
  47 | ERROR   | The array declaration extends to column 155 (the limit is 80). The array content
     |         | should be split up over multiple lines
  49 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  50 | ERROR   | The $_POST super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->request->get('connection_token')
     |         | instead
  71 | ERROR   | The array declaration extends to column 113 (the limit is 80). The array content
     |         | should be split up over multiple lines
  75 | ERROR   | The array declaration extends to column 97 (the limit is 80). The array content
     |         | should be split up over multiple lines
  78 | ERROR   | The $_POST super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->request->get('connection_token')
     |         | instead
  88 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 145 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 169 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 174 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 190 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 199 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 215 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 226 | ERROR   | The $_GET super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->query->get('origin') instead
 227 | ERROR   | The $_GET super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->query->get('origin') instead
 251 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 256 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 264 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 273 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 293 | ERROR   | The $_GET super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->query->get('origin') instead
 294 | ERROR   | The $_GET super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->query->get('origin') instead
 316 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 422 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 430 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 432 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 453 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 457 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 467 | WARNING | User::load calls should be avoided in classes, use dependency injection instead
 473 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 522 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 538 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 558 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 585 | ERROR   | The $_GET super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->query->get('origin') instead
 586 | ERROR   | The $_GET super global must not be accessed directly; inject the request_stack
     |         | service and use $stack->getCurrentRequest()->query->get('origin') instead
 603 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 614 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------

Time: 631ms; Memory: 18MB
📌 Task
Status

Needs work

Version

3.0

Component

Code

Created by

🇪🇸Spain Eduardo Morales Alberti Spain, 🇪🇺

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

  • First commit to issue fork.
  • @_pratik_ opened merge request.
  • Assigned to annmarysruthy
  • Issue was unassigned.
  • Assigned to Rashmisoni
  • 🇮🇳India Rashmisoni Bangalore

    Found More issues.

    FILE: /Users/rashmi.krishnachand/projects/drupal-d10/modules/contrib/social-login/README.md
    -------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    -------------------------------------------------------------------------------------------
    35 | WARNING | Line exceeds 80 characters; contains 89 characters
    36 | WARNING | Line exceeds 80 characters; contains 91 characters
    37 | WARNING | Line exceeds 80 characters; contains 95 characters
    96 | WARNING | Line exceeds 80 characters; contains 112 characters
    -------------------------------------------------------------------------------------------

    FILE: /Users/rashmi.krishnachand/projects/drupal-d10/modules/contrib/social-login/social_login.module
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
    180 | WARNING | Only string literals should be passed to t() where possible
    194 | WARNING | Only string literals should be passed to t() where possible
    209 | WARNING | Only string literals should be passed to t() where possible
    219 | ERROR | Unnecessarily gendered language in a comment
    235 | WARNING | Only string literals should be passed to t() where possible
    437 | ERROR | Blank lines are not allowed after DEFAULT statements
    678 | ERROR | The array declaration extends to column 105 (the limit is 80). The array content should be split up over multiple lines
    -----------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/rashmi.krishnachand/projects/drupal-d10/modules/contrib/social-login/src/Form/SocialLoginAdminSettings.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
    464 | ERROR | The array declaration extends to column 124 (the limit is 80). The array content should be split up over multiple lines
    ---------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/rashmi.krishnachand/projects/drupal-d10/modules/contrib/social-login/src/Controller/SocialLoginController.php
    --------------------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    --------------------------------------------------------------------------------------------------------------------------------------
    47 | ERROR | The array declaration extends to column 155 (the limit is 80). The array content should be split up over multiple lines
    71 | ERROR | The array declaration extends to column 113 (the limit is 80). The array content should be split up over multiple lines
    75 | ERROR | The array declaration extends to column 97 (the limit is 80). The array content should be split up over multiple lines
    --------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/rashmi.krishnachand/projects/drupal-d10/modules/contrib/social-login/src/Event/SocialLoginUserLinkedEvent.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 6 LINES
    ---------------------------------------------------------------------------------------------------------------------------
    23 | ERROR | Missing @var tag in member variable comment
    24 | ERROR | Class property $social_network_profile_data should use lowerCamel naming without underscores
    37 | ERROR | Public method name "SocialLoginUserLinkedEvent::set_social_network_profile_data" is not in lowerCamel format
    44 | ERROR | Public method name "SocialLoginUserLinkedEvent::get_social_network_profile_data" is not in lowerCamel format
    51 | ERROR | Public method name "SocialLoginUserLinkedEvent::set_account" is not in lowerCamel format
    58 | ERROR | Public method name "SocialLoginUserLinkedEvent::get_account" is not in lowerCamel format
    ---------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/rashmi.krishnachand/projects/drupal-d10/modules/contrib/social-login/src/Event/SocialLoginUserLoginEvent.php
    --------------------------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 5 LINES
    --------------------------------------------------------------------------------------------------------------------------
    24 | ERROR | Class property $social_network_profile_data should use lowerCamel naming without underscores
    37 | ERROR | Public method name "SocialLoginUserLoginEvent::set_social_network_profile_data" is not in lowerCamel format
    44 | ERROR | Public method name "SocialLoginUserLoginEvent::get_social_network_profile_data" is not in lowerCamel format
    51 | ERROR | Public method name "SocialLoginUserLoginEvent::set_account" is not in lowerCamel format
    58 | ERROR | Public method name "SocialLoginUserLoginEvent::get_account" is not in lowerCamel format
    --------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/rashmi.krishnachand/projects/drupal-d10/modules/contrib/social-login/src/Event/SocialLoginUserCreatedEvent.php
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 5 LINES
    ----------------------------------------------------------------------------------------------------------------------------
    23 | ERROR | Class property $social_network_profile_data should use lowerCamel naming without underscores
    36 | ERROR | Public method name "SocialLoginUserCreatedEvent::set_social_network_profile_data" is not in lowerCamel format
    43 | ERROR | Public method name "SocialLoginUserCreatedEvent::get_social_network_profile_data" is not in lowerCamel format
    50 | ERROR | Public method name "SocialLoginUserCreatedEvent::set_account" is not in lowerCamel format
    57 | ERROR | Public method name "SocialLoginUserCreatedEvent::get_account" is not in lowerCamel format
    ----------------------------------------------------------------------------------------------------------------------------

    Time: 282ms; Memory: 16MB

  • Issue was unassigned.
  • 🇪🇸Spain Eduardo Morales Alberti Spain, 🇪🇺

    Thank you, _pratik_, is a good start.

  • First commit to issue fork.
  • @urvashi_vora opened merge request.
  • @urvashi_vora opened merge request.
  • @urvashi_vora opened merge request.
  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    Facing some weird issue with the branch. Everytime taking pull of 3.x and pushing the changes in issue branch, but after creating a MR, it shows merge blocked.

    HELP!!

    Tried rebasing too.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India sakthi_dev

    Created a patch. Please review.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work about 1 year ago
  • 🇮🇳India arpitk

    HI The patch #18 it applied cleanly. However these errors/warnings are produced when running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,js . Tested on Drupal 9.5.8 and social_login:3.x-dev

    Thanks!

  • Status changed to Needs review 11 months ago
  • 🇮🇳India chaitanyadessai

    Fixed most fixable issues.

  • Status changed to Needs work 11 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The issue summary shows that seven files must be changed, while the last patch changes 11 files.

    Please notice this issue has been created from a maintainer for this project, who wrote:

    Solve the following coding standard

    He did not open an issue to solve all the warnings/errors reported by PHP_CodeSniffer.

Production build 0.69.0 2024