Some comments are missing punctuation in the end and some arrays could be split up for readability.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

trogels’s picture

StatusFileSize
new6.12 KB
trogels’s picture

Status: Active » Needs review
markhalliwell’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Needs work
Issue tags: +phpcs, +coder
Related issues: +#2852350: [jquery_update] 7.x-3.0 stable release

A general phpcs coder review should happen on this project.

markhalliwell’s picture

markhalliwell’s picture

Title: Code style » Fix errors and warnings of phpcs coder review
anoopsingh92’s picture

Assigned: Unassigned » anoopsingh92

Hi,

I am checking this.

Thanks

mcdruid’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev

Any changes will be in the 7.x-4.x branch.

anoopsingh92’s picture

I was trying to apply patch #1. That was not working now That's why I am working on it.

Getting this error.

Lenovo@LAPTOP-PDE747K8 MINGW64 /c/xampp/htdocs/drupal-9/web/modules/contrib/jquery_update-2349641 (2349641-fix-errors-and)
$ git apply -v 2349641-code-style.patch
Checking patch jquery_update.module...
error: while searching for:
  // Modified System Library.
  if ($module === 'system') {

    // Make sure we inject either the minified or uncompressed version as desired.
    $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min';
    $cdn = variable_get('jquery_update_jquery_cdn', 'none');


error: patch failed: jquery_update.module:82
error: jquery_update.module: patch does not apply

Thanks

anoopsingh92’s picture

StatusFileSize
new138.2 KB

Hello,

I have fixed some issues and uploaded a patch.
please review this patch.

These issues are still pending.

Lenovo@LAPTOP-PDE747K8 MINGW64 /c/xampp/htdocs/drupal-9/web/modules/contrib ((4106d4a...))
$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig jquery_update-2349641/

FILE: C:\xampp\htdocs\drupal-9\web\modules\contrib\jquery_update-2349641\jquery_update.module
---------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
---------------------------------------------------------------------------------------------------------------------------
 181 | ERROR   | Doc comment is empty
 240 | ERROR   | Doc comment is empty
 481 | ERROR   | Doc comment short description must be on a single line, further text should be a separate paragraph
 621 | ERROR   | Return type "array The keys are library hooks  and the values are each arrays of" must not contain spaces
 688 | WARNING | Unused variable $jspath.
 690 | WARNING | Unused variable $file_updated.
 760 | ERROR   | Doc comment for parameter $version does not match actual variable name <undefined>
 793 | ERROR   | Doc comment for parameter $version does not match actual variable name $jquery_version
---------------------------------------------------------------------------------------------------------------------------

Time: 589ms; Memory: 20MB

Thanks

anoopsingh92’s picture

Assigned: anoopsingh92 » Unassigned
Status: Needs work » Needs review
atul_ghate’s picture

Assigned: Unassigned » atul_ghate

I will review this patch.

solideogloria’s picture

Status: Needs review » Needs work

The status should remain "Needs Work" until all the pending issues have been resolved.

mulambo’s picture

Status: Needs work » Needs review
StatusFileSize
new138.93 KB

I've updated patch 9 to fix remaining problems.

mcdruid’s picture

Assigned: atul_ghate » Unassigned
Status: Needs review » Needs work
Issue tags: +Needs reroll

If we want to do this to 7.x-4.x we'll need a new patch and preferably as soon as possible as we're hoping to create a stable release from this branch, after which I don't anticipate many significant changes.

mcdruid’s picture

Status: Needs work » Needs review
StatusFileSize
new19.78 KB

Here's the result of running:

$ phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md --ignore='replace/*' .

...against 7.x-4.x today.

The output was:

PHPCBF RESULT SUMMARY
-----------------------------------------------------------------------------------
FILE                                                               FIXED  REMAINING
-----------------------------------------------------------------------------------
/modules/contrib/jquery_update/jquery_update.install               5      1
/modules/contrib/jquery_update/jquery_update.admin.inc             17     2
/modules/contrib/jquery_update/jquery_update.module                25     23
/modules/contrib/jquery_update/tests/jquery_update.test            9      1
/modules/contrib/jquery_update/tests/jquery_update_test.module     1      1
-----------------------------------------------------------------------------------
A TOTAL OF 57 ERRORS WERE FIXED IN 5 FILES
-----------------------------------------------------------------------------------

Let's check if these changes look sane and ensure there's no problem with tests (keeping in mind that test coverage is pretty minimal still).

mcdruid’s picture

StatusFileSize
new3.1 KB
new20.11 KB

The CBF changes mostly look okay, but here are a couple of manual tweaks; I mostly didn't like what had been done to the t()'s arrays in form API definitions.

Running CBF again confirms "No fixable errors were found".

I think we could commit these and then look at the remaining issues that require manual fixes.

  • mcdruid committed e38a573 on 7.x-4.x
    Issue #2349641 by mcdruid, anoopsingh92, trogels, Mulambo: Fix errors...
mcdruid’s picture

Issue tags: -Needs reroll
StatusFileSize
new11.43 KB

Manual fixes required to get the following to pass (/ run) with no output:

drupal-7.x/sites/all/modules/contrib/jquery_update$ phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md --ignore='replace/*' .

I wasn't sure about adding the type hinting for arrays, but I've checked manually in PHP 5.3 and everything seems to work okay.

Let's check that tests still pass.

  • mcdruid committed 8be67fb on 7.x-4.x
    Issue #2349641 by mcdruid, anoopsingh92, trogels, Mulambo: Fix errors...
mcdruid’s picture

Status: Needs review » Fixed

Hopefully that's everything for now.

Will try to review any future changes with phpcs too.

Thanks everybody that contributed!

Status: Fixed » Closed (fixed)

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