Comments

jayesh_makwana created an issue. See original summary.

jayesh_makwana’s picture

We create a patch for solving coding standard issues for this module. Please check and apply it.

aneek’s picture

Thanks for the patch. This will be addressed in the next release as this is not a blocker.

Regards,
Aneek

aneek’s picture

Status: Active » Needs review
dhruveshdtripathi’s picture

Assigned: jayesh_makwana » dhruveshdtripathi
Status: Needs review » Needs work

Patch applied. But giving warning about extra whitespace.

Assigning issue to myself for changing readme text as readme template: https://www.drupal.org/docs/develop/documenting-your-project/readme-template

dhruveshdtripathi’s picture

Assigned: dhruveshdtripathi » Unassigned
Status: Needs work » Needs review
StatusFileSize
new10.43 KB
new7.47 KB

Updated patch and interdiff added.

prajaankit’s picture

Assigned: Unassigned » prajaankit

Hi dhruveshdtripathi,

Firstly thanks for you work, i applied you patch, i get some error or warnings,

[vagrant@localhost html]$ cd rate_limiter/
[vagrant@localhost rate_limiter]$ git apply -v coding_standard_issues-2885396-6.patch
Checking patch README.md...
Checking patch config/install/rate_limiter.settings.yml...
Checking patch rate_limiter.info.yml...
Checking patch rate_limiter.install...
Checking patch rate_limiter.links.menu.yml...
Checking patch rate_limiter.module...
Checking patch rate_limiter.routing.yml...
Checking patch rate_limiter.services.yml...
Checking patch src/Form/RateLimiterConfigForm.php...
Checking patch src/RateLimitManager.php...
Checking patch src/RateLimitManagerInterface.php...
Checking patch src/RateLimitMiddleware.php...
Checking patch src/Tests/RateLimiterTest.php...
Applied patch README.md cleanly.
Applied patch config/install/rate_limiter.settings.yml cleanly.
Applied patch rate_limiter.info.yml cleanly.
Applied patch rate_limiter.install cleanly.
Applied patch rate_limiter.links.menu.yml cleanly.
Applied patch rate_limiter.module cleanly.
Applied patch rate_limiter.routing.yml cleanly.
Applied patch rate_limiter.services.yml cleanly.
Applied patch src/Form/RateLimiterConfigForm.php cleanly.
Applied patch src/RateLimitManager.php cleanly.
Applied patch src/RateLimitManagerInterface.php cleanly.
Applied patch src/RateLimitMiddleware.php cleanly.
Applied patch src/Tests/RateLimiterTest.php cleanly.
[vagrant@localhost rate_limiter]$ cd ../
[vagrant@localhost html]$ drupalcs rate_limiter/

FILE: /var/www/html/rate_limiter/src/Form/RateLimiterConfigForm.php
----------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
----------------------------------------------------------------------
38 | WARNING | [ ] Possible useless method overriding detected
194 | ERROR | [x] Expected 1 blank line after function; 0 found
195 | ERROR | [x] The closing brace for the class must have an
| | empty line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/rate_limiter/src/RateLimitManager.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
315 | ERROR | [x] Expected 1 blank line after function; 0 found
316 | ERROR | [x] The closing brace for the class must have an empty
| | line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/rate_limiter/src/RateLimitManagerInterface.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
82 | ERROR | [x] Expected 1 blank line after function; 0 found
83 | ERROR | [x] The closing brace for the interface must have an
| | empty line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/rate_limiter/src/RateLimitMiddleware.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
61 | ERROR | [x] Expected 1 blank line after function; 0 found
62 | ERROR | [x] The closing brace for the class must have an empty
| | line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: /var/www/html/rate_limiter/src/Tests/RateLimiterTest.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
63 | ERROR | [x] Expected 1 blank line after function; 0 found
64 | ERROR | [x] The closing brace for the class must have an empty
| | line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 293ms; Memory: 8Mb

I update your Patch.

prajaankit’s picture

StatusFileSize
new9.01 KB

NOW only one warning left.

FILE: /var/www/html/rate_limiter/src/Form/RateLimiterConfigForm.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
38 | WARNING | Possible useless method overriding detected
----------------------------------------------------------------------

Time: 306ms; Memory: 8Mb
please review it.

Thanks :)

prajaankit’s picture

Assigned: prajaankit » Unassigned
aneek’s picture

Hello @dhruveshdtripathi & prajaankit,

Thanks for your efforts. I'd like to ask you both:

1. Which coding standard is being used? @prajaankit I don't see phpcs --standard=Drupal in your checks. Also I believe drupalcs is merged into Coder and is not obsolete? Please check that once.
2. It's better to set PAReview.sh (https://github.com/klausi/pareviewsh / https://www.drupal.org/project/pareviewsh) in local.

I ran a report through it and below are the errors/warnings found in the current branch:

Review of the 8.x-1.x branch (commit e8cf8c7):
<ul>
<li><a href="https://www.drupal.org/project/coder">Coder Sniffer</a> has found some issues with your code (please check the <a href="https://www.drupal.org/node/318">Drupal coding standards</a>). See attachment.</li>
<li><a href="https://www.drupal.org/project/drupalpractice">DrupalPractice</a> has found some issues with your code, but could be false positives.

FILE: /root/repos/pareviewsh/pareview_temp/rate_limiter.info.yml
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------
 8 | WARNING | All dependencies must be prefixed with the project name,
   |         | for example "drupal:"
 9 | WARNING | All dependencies must be prefixed with the project name,
   |         | for example "drupal:"
--------------------------------------------------------------------------


FILE: /root/repos/pareviewsh/pareview_temp/src/RateLimitManager.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------
  85 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
 233 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
 272 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
--------------------------------------------------------------------------

Time: 46ms; Memory: 6Mb
<i>This automated report was generated with <a href="https://www.drupal.org/project/pareviewsh">PAReview.sh</a>, your friendly project application review script. You can also use the <a href="http://pareview.sh">online version</a> to check your project. You have to get a <a href="https://www.drupal.org/node/1975228">review bonus</a> to get a review from me.</i>

FILE: /root/repos/pareviewsh/pareview_temp/rate_limiter.info.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 9 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...os/pareviewsh/pareview_temp/config/install/rate_limiter.settings.yml
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
 13 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: /root/repos/pareviewsh/pareview_temp/rate_limiter.services.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 16 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: /root/repos/pareviewsh/pareview_temp/rate_limiter.module
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
 1 | ERROR | [x] The PHP open tag must be followed by exactly one blank
   |       |     line
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: /root/repos/pareviewsh/pareview_temp/rate_limiter.install
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
 1 | ERROR | [x] The PHP open tag must be followed by exactly one blank
   |       |     line
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: /root/repos/pareviewsh/pareview_temp/src/Tests/RateLimiterTest.php
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
 26 | ERROR | The @var tag must be the first tag in a member variable
    |       | comment
--------------------------------------------------------------------------


FILE: ...ot/repos/pareviewsh/pareview_temp/src/Form/RateLimiterConfigForm.php
--------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------
  38 | WARNING | [ ] Possible useless method overriding detected
 142 | ERROR   | [x] Short array syntax must be used to define arrays
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: /root/repos/pareviewsh/pareview_temp/rate_limiter.routing.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 7 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: /root/repos/pareviewsh/pareview_temp/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
 39 | WARNING | Line exceeds 80 characters; contains 92 characters
 65 | WARNING | Line exceeds 80 characters; contains 81 characters
 78 | WARNING | Line exceeds 80 characters; contains 126 characters
 91 | WARNING | Line exceeds 80 characters; contains 114 characters
----------------------------------------------------------------------


FILE: /root/repos/pareviewsh/pareview_temp/rate_limiter.links.menu.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 159ms; Memory: 8Mb

This is done in the online version https://pareview.sh/ (https://pareview.sh/node/2309). I believe, it would be great if these are fixed first then we would re-visit the README.md file and others.
P.S: Please post an interdiff.txt every time.

Cheers!!

aneek’s picture

Status: Needs review » Needs work
prajaankit’s picture

Assigned: Unassigned » prajaankit
prajaankit’s picture

Hi aneek ,

Thanks for your review.

CentOS box I have configured the drupalcs like this alias drupalcs="phpcs --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,js,css,info,txt'" so phpcs and drupalcs are same...

Thanks

prajaankit’s picture

Assigned: prajaankit » Unassigned
Status: Needs work » Needs review