Fix the issues reported by phpcs

Created on 18 June 2020, over 4 years ago
Updated 23 May 2023, over 1 year ago

Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig for the module shows the following issues that needs to be fixed.

FILE: ./tests/src/Kernel/NgLightboxTest.php
 23 | ERROR | [ ] The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple
    |       |     lines
 39 | ERROR | [x] Expected 1 blank line after function; 0 found
 55 | ERROR | [ ] The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple
    |       |     lines

FILE: ./tests/src/Functional/NgLightboxWebTest.php
  3 | ERROR | [x] There must be one blank line after the namespace declaration
 28 | ERROR | [ ] The array declaration extends to column 94 (the limit is 80). The array content should be split up over multiple
    |       |     lines

FILE: ./src/NgLightboxPass.php
 18 | WARNING | Unused variable $id.

FILE: ./src/NgLightbox.php
  79 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
  99 | WARNING | [x] '@TODO, decide whether we want to try and support paths or to adopt routes' should match the format '@todo Fix
     |         |     problem X here.'
 111 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead

FILE: ./src/Form/NgLightboxSettingsForm.php
  6 | WARNING | [x] Unused use statement
 12 | ERROR   | [x] Missing class doc comment
 14 | ERROR   | [ ] Missing short description in doc comment
 26 | ERROR   | [ ] Parameter $lightbox_renderers is not described in comment

FILE: ./README.md
  5 | WARNING | Line exceeds 80 characters; contains 82 characters
  8 | WARNING | Line exceeds 80 characters; contains 93 characters
  9 | WARNING | Line exceeds 80 characters; contains 96 characters
 16 | WARNING | Line exceeds 80 characters; contains 91 characters
 18 | WARNING | Line exceeds 80 characters; contains 94 characters
๐Ÿ“Œ Task
Status

RTBC

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Suresh Prabhu Parkala Bangalore

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.

  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Assigned to vitorbs
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil vitorbs Belo Horizonte

    Working on it.

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil vitorbs Belo Horizonte

    I'm having the same problem, the patch doesn't apply, what should i do? If anyone can help me...

    Skipped patch 'README.txt'.
    Skipped patch 'src/NgLightbox.php'.
    Skipped patch 'src/Tests/NgLightboxTest.php'.
    Checking patch src/Form/NgLightboxSettingsForm.php...
    error: while searching for:
    namespace Drupal\ng_lightbox\Form;
    
    use Drupal\Core\Config\ConfigFactoryInterface;
    use Drupal\Core\Extension\ModuleHandlerInterface;
    use Drupal\Core\Form\ConfigFormBase;
    use Drupal\Core\Form\FormStateInterface;
    use Drupal\ng_lightbox\NgLightbox;
    use Symfony\Component\DependencyInjection\ContainerInterface;
    
    class NgLightboxSettingsForm extends ConfigFormBase {
    
      /**
       * @var \Drupal\Core\Config\ConfigFactoryInterface
       */
      protected $config;
    
    error: patch failed: src/Form/NgLightboxSettingsForm.php:3
    error: src/Form/NgLightboxSettingsForm.php: patch does not apply
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil lucienchalom

    I tried to reroll and merge the las two patches as they had different changes.

    The test are failing! I could not fix it, so keeping in needs work.

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil

    Hi I did a reroll, please revise.

  • Assigned to Charchil Khandelwal
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    I will review this.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    I reviewed patch #17 its working but still I can see some errors and warnings.

    FILE: ...:\xampp\htdocs\abc\drupal\modules\ng_lightbox\ng_lightbox.module
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    1 | ERROR | [x] End of line character is invalid; expected "\n" but
    | | found "\r\n"
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------

    FILE: ...c\drupal\modules\ng_lightbox\src\Form\NgLightboxSettingsForm.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    1 | ERROR | [x] End of line character is invalid; expected "\n" but
    | | found "\r\n"
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------

    FILE: ...:\xampp\htdocs\abc\drupal\modules\ng_lightbox\src\NgLightbox.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ----------------------------------------------------------------------
    1 | ERROR | [x] End of line character is invalid; expected "\n"
    | | but found "\r\n"
    112 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    | | dependency injection instead
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------

    FILE: ...mpp\htdocs\abc\drupal\modules\ng_lightbox\src\NgLightboxPass.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ----------------------------------------------------------------------
    1 | ERROR | [x] End of line character is invalid; expected "\n"
    | | but found "\r\n"
    18 | WARNING | [ ] Unused variable $id.
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------

    FILE: ...abc\drupal\modules\ng_lightbox\src\NgLightboxServiceProvider.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    1 | ERROR | [x] End of line character is invalid; expected "\n" but
    | | found "\r\n"
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------

    FILE: ...l\modules\ng_lightbox\tests\src\Functional\NgLightboxWebTest.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    1 | ERROR | [x] End of line character is invalid; expected "\n" but
    | | found "\r\n"
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------

    FILE: ...c\drupal\modules\ng_lightbox\tests\src\Kernel\NgLightboxTest.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    1 | ERROR | [x] End of line character is invalid; expected "\n" but
    | | found "\r\n"
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------

    FILE: ...abc\drupal\modules\ng_lightbox\tests\src\Unit\NgLightboxTest.php
    ----------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------
    1 | ERROR | [x] End of line character is invalid; expected "\n" but
    | | found "\r\n"
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------

    SO moving to needs work.

  • Status changed to Needs work over 1 year ago
  • @charchil-khandelwal opened merge request.
  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Charchil Khandelwal

    Some of the errors and warnings are fixed now.
    Created MR !7 for this issue.
    Please review.

    Thank you.

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil lucienchalom

    @charchil thank you for opening a MR!, that helps on reviews a lot.
    please be careful with naming branches for a MR, the way it is now the branch 2.x already exists (because is the branch for this version) so git checkout -b '2.x' --track ng_lightbox-3152816/'2.x' cannot be applied.
    We need to use something like git checkout -b '3152816' --track ng_lightbox-3152816/'2.x' instead.

    Also, please don't break the line of a code in the README.md.
    That line is meant to help people just copy and past the code on their terminals, but with the line break, it will also break in the terminal and therefore, not work as expected.

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil lucienchalom

    There is still one error to be fixed

    FILE: ...\modules\ng_lightbox\src\NgLightbox.php
    ----------------------------------------------------------------------
    FOUND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
    112 | WARNING | [ ] \Drupal calls should be avoided in classes, use
    | | dependency injection instead
    ----------------------------------------------------------------------
  • Assigned to elber
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil

    I will try to fix it.

  • @elber opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil

    Hi I fixed the tests please revise.

  • ๐Ÿ‡ง๐Ÿ‡ทBrazil lucienchalom

    Te tests are passing and the DI was fixed. \o/

    The remaining cs of

    FILE: /.../modules/contrib/ng_lightbox/README.md
    ----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------
     17 | WARNING | Line exceeds 80 characters; contains 87 characters
    ----------------------------------------------------------------------------------------------

    refers to
    compass compile --no-sourcemap --no-debug-info --force -e production sass/lightbox.scss
    that I consider that should stay this way,

    I just added Escaping Backticks to maintain as a code in the visualization and be shorter.
    =)

  • Assigned to elber
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil

    I will review it.

  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil

    Hi coding standards has been fixed.

    Module keeps working as expected

    Test arent't breaking.

    Moving to RTBC.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, show which command has been used, which arguments have been used, and which report that command shown.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Indra patil Bangalore
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    6 pass
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil

    Hi I just fixed the characters limit. Please revise.

  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil

    Hi we can move to RTBC I ran Drupal phpcs command and it not exist anymore

    pcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .
    
    No fixable errors were found
    
    Time: 152ms; Memory: 8MB
    

    Module keeps working as expected.

    PHPCS were fixed.

    Moving to RTBC.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    The person who provided the last patch or done the last commit in the MR cannot change the status to Reviewed & tested by the community.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    +   * @param Symfony\Component\HttpFoundation\RequestStack $request
    +   *   The request method.

    That is not a method.

    -    // @TODO, decide whether we want to try and support paths or to adopt routes
    +    // @todo , decide whether we want to try and support paths or to adopt routes
    

    What follows @todo is a sentence: It starts with a capitalized word and ends with a period.
    The comma between @todo and the sentence is not used, either when there are spaces between @todo and the comma or not.

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

    Also, if I run phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig for the 2.x branch of the module, I get a slightly different report.

  • Assigned to elber
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil

    HI I will see it.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    6 pass
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    +   * @param Symfony\Component\HttpFoundation\RequestStack $request
    +   *   The request method.

    That is not a method.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    6 pass
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil elber Brazil
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil lucienchalom

    runing phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig returns a clean terminal.

    at src/NgLightbox.php line 111

    -     // @TODO, decide whether we want to try and support paths or to adopt routes
    +    // @todo Decide whether we want to try and support paths or to adopt routes.

    but the full sentence is broke in two, the full sentence is

    // Decide whether we want to try and support paths or to adopt routes
    // like core is trying to force us into.
    

    so it should have a captalized word but leave the period only on the second line.

    everything else looks good to me,

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    6 pass
  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil lucienchalom

    Thank you for the quick response.

    Everything looks good to me, moving to RTBC

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kbk1992 Hyderabad

    bharath-kondeti โ†’ made their first commit to this issueโ€™s fork.

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    6 pass
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kbk1992 Hyderabad
  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡ง๐Ÿ‡ทBrazil lucienchalom

    Fixed as requested.

    all phpcs clean.

Production build 0.71.5 2024