Fix the issues reported by phpcs

Created on 22 June 2022, about 2 years ago
Updated 12 March 2024, 3 months ago

$ phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml cognito/

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Aws\Cognito.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------
189 | ERROR | [x] There should be no white space before a closing "}"
189 | ERROR | [x] Closing brace must be on a line by itself
318 | WARNING | [x] '@TODO, we should not automatically verify the email. See' should match the format '@todo Fix problem X here.'
389 | WARNING | [x] '@TODO, This could be cached.' should match the format '@todo Fix problem X here.'
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Aws\CognitoInterface.php
-------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------
86 | ERROR | [ ] Parameter $confirmationCode is not described in comment
90 | ERROR | [x] Parameter comment must end with a full stop
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\CognitoToken.php
----------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------------------------
13 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
149 | ERROR | [x] Parameter comment must end with a full stop
186 | ERROR | [ ] Missing short description in doc comment
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\CognitoTokenInterface.php
----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------
7 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
----------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Commands\CognitoCommands.php
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
16 | ERROR | Missing parameter type
-----------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Form\CognitoAccountForm.php
----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
66 | ERROR | Parameter $eventDispatcher is not described in comment
----------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Form\Email\NewPasswordForm.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------
85 | ERROR | The array declaration extends to column 95 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Form\Email\PassResetForm.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------
99 | ERROR | The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Form\Email\UserLoginForm.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
140 | ERROR | The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Form\VerifyEmail.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
14 | ERROR | [x] Missing class doc comment
111 | ERROR | [ ] The array declaration extends to column 92 (the limit is 80). The array content should be split up over multiple lines
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Plugin\rest\resource\CognitoAuthToken.php
------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
37 | ERROR | [ ] Missing parameter type
39 | ERROR | [ ] Missing parameter type
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\src\Plugin\rest\resource\CognitoUserRegistrationResource.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------
209 | ERROR | [x] Each index in a multi-line array must be on a new line
209 | WARNING | [x] A comma should follow the last multiline array item. Found: TRUE
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\tests\src\Functional\CognitoRegistrationResourceTest.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------
155 | ERROR | [x] Expected 1 blank line after function; 2 found
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\tests\src\Kernel\Email\LoginFormTest.php
-------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------
24 | ERROR | Missing member variable doc comment
-------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\contribution\web\modules\contrib\cognito\tests\src\Unit\Email\RegisterFormTest.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
142 | ERROR | The array declaration extends to column 90 (the limit is 80). The array content should be split up over multiple lines
--------------------------------------------------------------------------------------------------------------------------------------

Time: 1.1 secs; Memory: 12MB

📌 Task
Status

Needs review

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

Merge Requests

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, 🇮🇹
    -          // @TODO, we should not automatically verify the email. See
    +          // @todo , we should not automatically verify the email. See
    

    What follows @todo is a sentence, which starts with a word written in capital case and ends with a period.

    -  public function verifyUserAttribute($attributeName, $confirmationCode, $accessToken);
    +  public function verifyUserAttribute($confirmationCode, $attributeName, $accessToken);

    Has been verified that swapping parameters do not cause issues?

     /**
    - * Class CognitoToken.
    + * Class for CognitoToken.
      */
    

    Adding for does not make the documentation comment correct, since it should describe the class purpose, not say the class name.

    -   *   (optional) Either AccessToken or IdToken
    +   *   (optional) Either AccessToken or IdToken.

    Since the documentation comment is changed, it should also be made more comprehensible.

    +  /**
    +   * Constructs a new CognitoCommands object.
    +   *

    The class name must be fully name-spaced.

    -  public function report($cognitoUserFile) {
    +  public function report(array $cognitoUserFile) {
         if ($cognitoUserFile[0] !== '/') {
           $cognitoUserFile = getcwd() . '/' . $cognitoUserFile;
         }
    

    $cognitoUserFile is a string, not an array.

    -   * @param $plugin_id
    +   * @param array $plugin_id
        *   Plugin ID.

    $plugin_id is not type-hinted as array. See ResourceBase::__construct().

  • #14 comments fixed and recreate patch

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -          // @TODO, we should not automatically verify the email. See
    +          // @todo change automatically verify the email.
               // https://drupal.org/node/2907479 for the fix here.

    Still, there is no sentence. Also, in the existing text, the second sentence starts with a verb.

     /**
    - * Class CognitoToken.
    + * The Cognito Token class describe for cognito token.
      */

    The new description does not make sense.

    * @param string $tokenType
    - * (optional) Either AccessToken or IdToken
    + * (optional) Either AccessToken or IdToken.

    I know that is the description already used, but that describes the values that parameters can assume, not what that parameter is. Since that description is changed, it should be changed to show what it should show,
    Also, since that is a string, its values are 'AccessToken' and 'IdToken'.

       /**
    +   * Retrieves Token.
    +   *
        * @param string $tokenType
        *   Must be either AccessToken or IdToken.

    Token does not need to be in capital case. The parameter description is wrong for the same reason given for the previous change.

    +  /**
    +   * Constructs a CognitoCommands object.
    +   *
    

    The namespace is missing. Also, the usual comment speaks of new object.

    +  /**
    +   * The User Login Form constructor.
    

    That comment does not show neither the class name (which does not contain spaces) nor its namespace.
    Also, comments that describe a method start with a verb (Simple Present tense, third person singular).

    -   * @param $plugin_id
    +   * @param string $plugin_id
        *   Plugin ID.
    -   * @param $plugin_definition
    +   * @param array $plugin_definition
        *   Plugin definition.
        * @param array $serializer_formats
        *   Serializer Formats.
    

    The parameter descriptions all miss an article.

    -  public function __construct(array $configuration, $plugin_id, $plugin_definition, array $serializer_formats, LoggerInterface $logger, CognitoTokenInterface $cognitoToken) {
    +  public function __construct(array $configuration, string $plugin_id, array $plugin_definition, array $serializer_formats, LoggerInterface $logger, CognitoTokenInterface $cognitoToken) {
         parent::__construct($configuration, $plugin_id, $plugin_definition, $serializer_formats, $logger);
         $this->cognitoToken = $cognitoToken;

    $plugin_id is not type-hinted to string.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India TanujJain-TJ

    As patch #15 doesn't apply and throws error,

    error: patch failed: src/CognitoToken.php:184
    error: src/CognitoToken.php: patch does not apply
    error: patch failed: src/Form/Email/UserLoginForm.php:192
    error: src/Form/Email/UserLoginForm.php: patch does not apply
    error: patch failed: src/Plugin/rest/resource/CognitoUserRegistrationResource.php:200
    error: src/Plugin/rest/resource/CognitoUserRegistrationResource.php: patch does not apply
    error: patch failed: tests/src/Kernel/Email/LoginFormTest.php:20
    error: tests/src/Kernel/Email/LoginFormTest.php: patch does not apply

    adding a new patch to remove phpcs errors and addressing points from #12, #14, #17, please review.

  • Hi , The patch provided in #18 failed to apply. Attaching the error ss for reference.

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

    SInce an issue fork has been created, let us continue using that.

  • First commit to issue fork.
  • Merge request !7Issue#3291859: Fix phpcs issues. → (Open) created by sakthi_dev
  • Status changed to Needs review 5 months ago
  • 🇮🇳India sakthi_dev

    Please review.

  • First commit to issue fork.
  • 🇮🇳India Preethy_ray

    Hi,
    Applied the MR !7 found one warning.

    FILE: .../cognito/src/Plugin/rest/resource/CognitoAuthToken.php
    ----------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------
     32 | WARNING | Line exceeds 80 characters; contains 82 characters
    ----------------------------------------------------------------------------
    
  • Pipeline finished with Failed
    3 months ago
    Total: 173s
    #117379
  • Pipeline finished with Failed
    3 months ago
    Total: 142s
    #117387
  • Pipeline finished with Failed
    3 months ago
    Total: 142s
    #117392
Production build 0.69.0 2024