Drupal Coding Standard Issue

Created on 11 August 2023, over 1 year ago
Updated 20 July 2024, 5 months ago

Problem/Motivation

FILE: /var/www/html/drupal_cms/drupal9/web/modules/contrib/lazy/js/lazy.js
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 27 | ERROR | TRUE, FALSE and NULL must be uppercase; expected "TRUE" but
    |       |     found "true"
--------------------------------------------------------------------------------



📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇮🇳India Rohit Rana

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Rohit Rana
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • 🇩🇰Denmark osman Copenhagen

    Hi Rahit,

    Are you positive you're running PHPCS with `Drupal`, and `DrupalPractice` coding-standards loaded? AFAIK, JavaScript boolean values should be lowercase, but for PHP it should be uppercase.

    You can check the installed standards via `phpcs -i`

    Because this is what I get:

    osman@drupal-web:/var/www/html$ vendor/bin/phpcs web/modules/contrib/lazy
    
    FILE: /var/www/html/web/modules/contrib/lazy/lazy.module
    ------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FormatterInterface.
    ------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/contrib/lazy/src/Form/LazyForm.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
     17 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Extension\ModuleHandlerInterface.
    ---------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 203ms; Memory: 10MB
    
    osman@drupal-web:/var/www/html$ vendor/bin/phpcs -i
    The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, Drupal, DrupalPractice, VariableAnalysis and SlevomatCodingStandard
    
    
  • First commit to issue fork.
  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 7 months ago
    Waiting for branch to pass
  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 7 months ago
    Waiting for branch to pass
  • 🇦🇺Australia VladimirAus Brisbane, Australia
  • Pipeline finished with Failed
    7 months ago
    #174807
  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 7 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    7 months ago
    Total: 148s
    #174817
  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 7 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    7 months ago
    Total: 144s
    #174821
  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 7 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    7 months ago
    Total: 192s
    #174829
  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 7 months ago
    Waiting for branch to pass
  • Pipeline finished with Success
    7 months ago
    #174836
  • Status changed to RTBC 7 months ago
  • 🇦🇺Australia jannakha Brisbane!

    all green!

  • 🇩🇰Denmark osman Copenhagen

    * Drupal 8
    * PHP 7.4
    * PHPCS 3.10.1 (stable)

    Before:

    osman@drupal8-web:/var/www/html$ ./vendor/bin/phpcs -s -p --standard=Drupal web/modules/lazy/
    ..E..E.... 10 / 10 (100%)
    
    
    
    FILE: /var/www/html/web/modules/lazy/js/lazy.js
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------
     27 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true" (Generic.PHP.UpperCaseConstant.Found)
    ---------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /var/www/html/web/modules/lazy/src/Form/LazyForm.php
    ------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------
     17 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Extension\ModuleHandlerInterface.
        |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
    ------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 294ms; Memory: 8MB
    

    After:

    osman@drupal8-web:/var/www/html$ ./vendor/bin/phpcs -s -p --standard=Drupal web/modules/lazy/
    .......... 10 / 10 (100%)
    
    
    Time: 984ms; Memory: 8MB
    
    • osman committed 0db8569e on 8.x-3.x
      Issue #3380611 by Rohit Rana, osman: Drupal Coding Standard Issue
      
  • Status changed to Fixed 6 months ago
  • 🇩🇰Denmark osman Copenhagen
  • 🇦🇺Australia VladimirAus Brisbane, Australia
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024