Fix the issues reported by phpcs

Created on 14 March 2023, over 1 year ago
Updated 22 February 2024, 4 months ago

Problem/Motivation

Fix the phpcs issues reported.

FILE: password_policy_history/tests/src/Unit/PasswordHistoryTest.php
------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------
 131 | ERROR | [x] Missing function doc comment
 134 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------


FILE: password_policy_history/password_policy_history.module
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 32 | ERROR | The $_POST super global must not be accessed directly; inject the request.stack service and use $stack->getCurrentRequest()->request->get('pass') instead
 32 | ERROR | The $_POST super global must not be accessed directly; inject the request.stack service and use $stack->getCurrentRequest()->request->get('pass') instead
------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: src/Plugin/migrate/process/PolicyConfiguration.php
------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
 127 | ERROR | Type hint "array" missing for $value
------------------------------------------------------------------------------------------------------

Time: 2.28 secs; Memory: 14MB

Steps to reproduce

Run phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,yml .

Proposed resolution

Fix the issues reported and re-run the above command to check all issues are fixed.

๐Ÿ“Œ Task
Status

Needs work

Version

4.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia hardikpandya

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

  • Issue created by @hardikpandya
  • @hardikpandya opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    +  /**
    +   * Set ReflectionClass object.
    +   */

    That does not describe what the method does. Then, parameters are not documented, nor is the return value.

  • First commit to issue fork.
  • @kkalashnikov opened merge request.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kkalashnikov Ghaziabad, India
  • Status changed to Needs review about 1 year ago
  • First commit to issue fork.
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    -  public function setProtectedProperty($object, $property, $value) {
    -    $reflection = new \ReflectionClass($object);
    -    $reflection_property = $reflection->getProperty($property);
    -    $reflection_property->setAccessible(true);
    -    $reflection_property->setValue($object, $value);
    -  }

    What reported by PHP_CodeSniffer and shown in the issue summary does not say that method must be removed.

  • First commit to issue fork.
  • @sakthi_dev opened merge request.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sakthi_dev

    Please review.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    +   * @param $object
    +   *   The object variable.
    +   * @param $property
    +   *   The property variable.
    +   * @param $value.
    +   *   The variable of value.

    Parameters are not described that way. It is not a helpful description, since it repeats the parameter names, adding variable. (Yes, a parameter is a local variable accessible from the function/method. That is how PHP works.)

    +   * @return NULL
    +   *   Returns Null.
    +   */

    If a method/function does not return anything, @return does not need to be added.

  • First commit to issue fork.
  • Merge request !50Resolve #3347789 "Comment 13" โ†’ (Open) created by Diego_Mow
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil Diego_Mow

    MR 50 fixes same code from MR 49 + Comments on #13.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom Alina Basarabeanu

    I applied the changes from MR 50 to Drupal Version 9.5.10 and Password Policy 4.0.0 but I still get a lot of phpcs errors.
    I will list just a few.

    FILE: /docroot/modules/contrib/password_policy/password_policy_delay/src/Plugin/PasswordConstraint/PasswordDelay.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------
    12 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Password\PasswordInterface.
    ---------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------

    FILE: /docroot/modules/contrib/password_policy/PATCHES.txt
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    -----------------------------------------------------------------------------------------------------------------------
    1 | WARNING | [ ] Line exceeds 80 characters; contains 104 characters
    5 | ERROR | [x] Expected 1 newline at end of file; 3 found
    -----------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------

    FILE: /docroot/modules/contrib/password_policy/password_policy.module
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------
    10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityInterface.
    ---------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY

    FILE: /docroot/modules/contrib/password_policy/password_policy_history/tests/src/Unit/PasswordHistoryTest.php
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 5 LINES
    ---------------------------------------------------------------------------------------------------------------------------
    7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Password\PasswordInterface.
    22 | ERROR | [x] Data types in @var tags need to be fully namespaced
    129 | ERROR | [x] Expected 1 blank line after function; 0 found
    130 | ERROR | [ ] Parameter $value is not described in comment
    137 | ERROR | [x] Doc comment parameter name "$value." must not end with a dot
    ---------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------

  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Anjali Mehta

    Anjali Mehta โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Anjali Mehta

    Kindly review the changes.
    Thank you.

  • Status changed to Needs review 5 months ago
  • Assigned to Kristen Pol
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    Assigning to myself for review.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    Duplicate issue found. I'll need to close one of these.

    ๐Ÿ“Œ Fix the issues reported by phpcs Needs work

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    apaderno โ†’ changed the visibility of the branch 3347789-phpcs to hidden.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    apaderno โ†’ changed the visibility of the branch phpcs-3347789 to hidden.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    apaderno โ†’ changed the visibility of the branch 3347789-fix-phpcs-issues to hidden.

  • Pipeline finished with Failed
    4 months ago
    Total: 215s
    #99850
  • Pipeline finished with Failed
    4 months ago
    Total: 184s
    #99858
  • Issue was unassigned.
  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    Merge conflict needs fixing.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Kristen Pol Santa Cruz, CA, USA

    Copying issue credits for people who worked on duplicate issue:

    ๐Ÿ“Œ Fix the issues reported by phpcs Needs work

Production build 0.69.0 2024