Support from Acquia helps fund testing for Drupal Acquia logo

Comments

heykarthikwithu created an issue. See original summary.

heykarthikwithu’s picture

Assigned: Unassigned » heykarthikwithu
Status: Active » Needs work
heykarthikwithu’s picture

Title: Depreciated methods in the code base. » Depreciated methods in the code base and code cleanup.
Assigned: heykarthikwithu » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
FileSize
27.53 KB

Status: Needs review » Needs work

The last submitted patch, 3: 2709935-3.patch, failed testing.

arjun_sreekumar’s picture

Assigned: Unassigned » arjun_sreekumar
Status: Needs work » Active
nerdstein’s picture

arjun_zyxware - are you working on this?

wellme’s picture

Assigned: arjun_sreekumar » wellme
Status: Active » Needs review
wellme’s picture

Assigned: wellme » Unassigned
nerdstein’s picture

Status: Needs review » Needs work

This patch does not apply cleanly...

Further, I've done a manual review of the patch and I don't think it's accurate for a number of reasons. I'll call out a few:

1. Line 31 of the patch adds "+ * @file" to a functional comment. This isn't correct.

2. "password_policy_check_constrains_password_confirm_process" has been renamed with "constraints" which was originally spelled wrong. The added comment states "Implements" which is incorrect, as this is not a hook. It's a custom callback. The comment added should be more accurate. It also does not account for the input parameter in the comment.

A quick spot check of the rest of the changes seem OK.

In lieu of rerolling this patch, I'm going to run PHPCBF on this and spot check the source files.

nerdstein’s picture

This is a mega patch that cleans up all code standard issues, deprecated functions, and removes unused interfaces.

The lone exception is the following:

FILE: ...es/contrib/password_policy/src/Annotation/PasswordConstraint.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 47 | ERROR | Class property $error_message should use lowerCamel
    |       | naming without underscores
----------------------------------------------------------------------

Time: 981ms; Memory: 12.75Mb

Changing this would prompt an API change and affect downstream modules. I am intentionally leaving this and we can consider this for the next major release.

benjy’s picture

Mostly looks good to me, few bits of trailing whitespace and missing newlines that's all. Looks like HEAD is broken, lets try get that fixed up first.

  1. +++ b/README.md
    @@ -1,13 +1,19 @@
    +This is a Drupal 8 module for the Password Policy module. This is ¶
    ...
    +Constraints are different ways that you can restrict a password. A ¶
    +policy is an instance of a constraint that define specific parameters ¶
    ...
    +Password Policy comes bundled with a password expiration feature. ¶
    +Policies define a time-based expiration logic (based on days) and ¶
    +administrators have the ability to manually expire all passwords by ¶
    

    These lines and many more now have whitespace on the end which should be removed.

  2. +++ b/password_policy.permissions.yml
    @@ -3,4 +3,4 @@ manage password reset:
    \ No newline at end of file
    
    +++ b/password_policy.routing.yml
    @@ -73,4 +73,4 @@ entity.password_policy.constraint.delete:
    \ No newline at end of file
    
    +++ b/password_policy.services.yml
    @@ -7,4 +7,4 @@ services:
    \ No newline at end of file
    

    Missing new lines.

  3. +++ b/src/Form/ConstraintDelete.php
    @@ -126,11 +137,19 @@ class ConstraintDelete extends ConfirmFormBase {
    +    return new Url('entity.password_policy.wizard.edit', ['machine_name' => $this->machineName, 'step' => 'constraint']);
    
    +++ b/src/Form/ConstraintEdit.php
    @@ -136,13 +153,17 @@ class ConstraintEdit extends FormBase {
    +    $url = Url::fromRoute('entity.password_policy.wizard.edit', ['machine_name' => $this->machineName, 'step' => 'constraint']);
    

    Two styles of doing the same thing.

  4. +++ b/src/Form/PasswordPolicyConstraintForm.php
    @@ -83,9 +98,13 @@ class PasswordPolicyConstraintForm extends FormBase {
    +      '#empty' => t('No constraints have been configured.'),
    

    $this->t()

  5. +++ b/src/Form/PasswordPolicyDeleteForm.php
    @@ -40,11 +42,12 @@ class PasswordPolicyDeleteForm extends EntityConfirmFormBase {
    \ No newline at end of file
    
    +++ b/src/Form/PasswordPolicyGeneralForm.php
    @@ -36,10 +39,10 @@ class PasswordPolicyGeneralForm extends FormBase {
    \ No newline at end of file
    

    Missing newlines.

nerdstein’s picture

That's odd - those are not reporting for me. I am going to download the latest Coder rules and see if I can get that to report. More soon...

Tests on HEAD has been broken and I fix the main modules in this patch. Sub modules are found here: https://www.drupal.org/node/2774969

I still want to try to get this patch in and then work out from there.

nerdstein’s picture

Status: Needs review » Needs work

Needed to rebase from recent commits, new patch coming

nerdstein’s picture

Status: Needs work » Needs review

New patch for review after rebase. Benji, I am not getting the newline errors you mentioned.

I updated my Coder standards from 2.7.0 to 2.7.1 to ensure it was up to snuff.

Output:

password_policy (2709935) $ phpcs --standard=Drupal * -p
.........................E...................


FILE: ...es/contrib/password_policy/src/Annotation/PasswordConstraint.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 47 | ERROR | Class property $error_message should use lowerCamel
    |       | naming without underscores
----------------------------------------------------------------------

Time: 1.43 secs; Memory: 12.75Mb

Please let me know if I am missing something. Moving back to Needs Review.

benjy’s picture

I was using Dreditor to view those.

mroycroft’s picture

I could not apply the patch from #11, here is the output from git apply -v issue-2709935-fix_standards-11.patch, while on the latest revision on 8.x-3.x branch:

issue-2709935-fix_standards-11.patch:10: trailing whitespace.
This is a Drupal 8 module for the Password Policy module. This is 
issue-2709935-fix_standards-11.patch:14: trailing whitespace.
Constraints are different ways that you can restrict a password. A 
issue-2709935-fix_standards-11.patch:15: trailing whitespace.
policy is an instance of a constraint that define specific parameters 
issue-2709935-fix_standards-11.patch:21: trailing whitespace.
Password Policy comes bundled with a password expiration feature. 
issue-2709935-fix_standards-11.patch:22: trailing whitespace.
Policies define a time-based expiration logic (based on days) and 
Checking patch README.md...
Checking patch password_policy.install...
Hunk #1 succeeded at 24 (offset 1 line).
Checking patch password_policy.links.action.yml...
Checking patch password_policy.module...
Checking patch password_policy.permissions.yml...
Checking patch password_policy.routing.yml...
Checking patch password_policy.services.yml...
Checking patch password_policy_character_types/src/Plugin/PasswordConstraint/CharacterTypes.php...
Checking patch password_policy_character_types/src/Tests/PasswordCharacterTypesOperations.php...
Checking patch password_policy_characters/src/Plugin/PasswordConstraint/PasswordCharacter.php...
Checking patch password_policy_characters/src/Tests/PasswordCharacterBehaviors.php...
Checking patch password_policy_characters/src/Tests/PasswordCharacterOperations.php...
Checking patch password_policy_history/src/Plugin/PasswordConstraint/PasswordHistory.php...
Checking patch password_policy_history/src/Tests/PasswordHistoryTests.php...
Checking patch password_policy_length/src/Plugin/PasswordConstraint/PasswordLength.php...
Checking patch password_policy_length/src/Tests/PasswordLengthBehaviors.php...
Checking patch password_policy_length/src/Tests/PasswordLengthOperations.php...
Checking patch password_policy_username/src/Plugin/PasswordConstraint/PasswordUsername.php...
Checking patch src/Annotation/PasswordConstraint.php...
Checking patch src/Controller/PasswordPolicyListBuilder.php...
Checking patch src/Entity/PasswordPolicy.php...
Checking patch src/EventSubscriber/PasswordPolicyEventSubscriber.php...
Checking patch src/Form/ConstraintDelete.php...
Checking patch src/Form/ConstraintEdit.php...
Checking patch src/Form/PasswordPolicyConstraintForm.php...
error: while searching for:
      '#prefix' => '<div id="configured-constraints">',
      '#suffix' => '</div>',
      '#theme' => 'table',
      '#header' => array($this->t('Plugin Id'), $this->t('Summary'), $this->t('Operations')),
      '#rows' => $this->renderRows($cached_values),
      '#empty' => t('No constraints have been configured.')
    );

    return $form;

error: patch failed: src/Form/PasswordPolicyConstraintForm.php:83
error: src/Form/PasswordPolicyConstraintForm.php: patch does not apply
Checking patch src/Form/PasswordPolicyDeleteForm.php...
Checking patch src/Form/PasswordPolicyGeneralForm.php...
Checking patch src/Form/PasswordPolicyRolesForm.php...
Checking patch src/PasswordConstraintBase.php...
Checking patch src/PasswordConstraintInterface.php...
Checking patch src/PasswordConstraintPluginManager.php...
Checking patch src/PasswordPolicyValidation.php...
Checking patch src/Tests/PasswordResetBehaviorsTest.php...
Checking patch src/Wizard/PasswordPolicyWizard.php...
mroycroft’s picture

Status: Needs review » Needs work

  • nerdstein committed 91f4f02 on 8.x-3.x
    Issue #2709935 by nerdstein, heykarthikwithu, wellme: Depreciated...
nerdstein’s picture

Status: Needs work » Fixed

I have this all cleaned up and I pushed the commit. Marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.