Fix the issues reported by phpcs

Created on 26 June 2023, about 1 year ago
Updated 31 May 2024, 28 days ago

GitLab CI reports PHP_CodeSniffer warnings/errors. The warnings/errors still to be fixed are the following.

FILE: ...ror_editor-3370177/src/Plugin/Field/FieldWidget/CodeMirrorEditorWidget.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 94 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    |       |     (SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.NullCoalesceOperatorNotUsed)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...custom/codemirror_editor-3370177/src/Commands/CodeMirrorEditorCommands.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 94 | ERROR | [x] Multi-line function declarations must have a trailing comma
    |       |     after the last parameter
    |       |     (Drupal.Functions.MultiLineFunctionDeclaration.MissingTrailingComma)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 506ms; Memory: 6MB

 
 

šŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India Prachi6824

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.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Prachi6824
  • Assigned to Prachi6824
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    Patch Failed to Apply
  • šŸ‡®šŸ‡³India Prachi6824

    Hello,

    I have created a patch to solve all the errors related to phpcs code standard within the .module file .
    Please review and apply it

  • I have tested your patch 3370177-#2.patch @prachi6824, it's working fine

  • Issue was unassigned.
  • Status changed to Needs work 12 months 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 and arguments have been used and which report that command shown. In this way, project maintainers can verify the patch/MR fixes all the warnings/errors.

  • Assigned to Prachi6824
  • šŸ‡®šŸ‡³India Prachi6824

    Hello @apaderno,

    I will go through my summary again and will update it with more clarifications.
    Thank you for reviewing my summary.

  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • šŸ‡®šŸ‡³India Prachi6824

    Problem/Motivation

    There are issues found in the .module file which are reported by PHP code sniffer.
    All the issues are mentioned above in the #1 comment issue summary.

    Steps to reproduce:

    1) Install the module.

    2) Run this php code standard command to detect the errors reporeted by the php code sniffer.
    phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/drupal/example_module

    3) Mention the proper path of the .module file or the file in which you want to detect the error.

    4) After running the command start solving the issues which are given by going to the line no. mentioned in the error.

    5) For further better understanding of the issue please do refer the following link which tells @deprecated PHPdoc tag format :

    https://www.drupal.org/about/core/policies/core-change-policies/drupal-d... ā†’

    Proposed resolution:

    Edit the code and solve the issue by implementing the correct code format.

  • Status changed to Needs work 12 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary has not yet updated.

  • Assigned to Prachi6824
  • Status changed to Needs review 12 months ago
  • šŸ‡®šŸ‡³India Prachi6824

    Updated issue summary again.

  • Status changed to Needs work 12 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    Truly, the issue summary has been updated once.

    The status is also for the patch that failed to apply and that needs to be changed.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    diff --git a/modules/contrib/codemirror_editor/codemirror_editor.module b/modules/contrib/codemirror_editor/codemirror_editor.module
    index e5e058e9..752b1d15 100644
    --- a/modules/contrib/codemirror_editor/codemirror_editor.module
    +++ b/modules/contrib/codemirror_editor/codemirror_editor.module

    The patch needs to be created from the directory containing the project files.

  • šŸ‡®šŸ‡³India Prachi6824

    Ok @apaderno I will work on the patch again and will recreate the patch to solve the issues.
    Thank You.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Assigned to RohitRawat676
  • Status changed to Active 11 months ago
  • Issue was unassigned.
  • Status changed to Needs review 11 months ago
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    14 pass
  • šŸ‡®šŸ‡³India RohitRawat676

    minor change in CodeMirrorEditorWidget.php file.

  • phpcbf --standard=Drupal your_module_directory

  • Status changed to Needs work 28 days ago
  • šŸ‡µšŸ‡­Philippines paraderojether

    Hi

    I reviewed patch #1, and there are still phpcs issues remaining shown below:

    codemirror_editor git:(147c3b7) curl https://www.drupal.org/files/issues/2023-07-31/CodeMirrorEditorWidget.php-3370177-14.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   663  100   663    0     0    360      0  0:00:01  0:00:01 --:--:--   361
    patching file 'src/Plugin/Field/FieldWidget/CodeMirrorEditorWidget.php'
    āžœ  codemirror_editor git:(147c3b7) āœ— cd ..
    āžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig codemirror_editor
    
    FILE: /Users/jetherparadero/Q2_DO/q2_issues/web/modules/contrib/codemirror_editor/codemirror_editor.module
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 4 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     62 | ERROR | The text '@deprecated Use Drupal\codemirror_editor\CodemirrorModeManagerInterface::getDefinitions() instead.' does not match the standard format: @deprecated in
        |       | %deprecation-version% and is removed from %removal-version%. %extra-info%.
     62 | ERROR | Each @deprecated tag must have a @see tag immediately following it
     67 | ERROR | The trigger_error message 'codemirror_editor_load_modes() is deprecated. Use Drupal\codemirror_editor\CodemirrorModeManagerInterface::getDefinitions() instead'
        |       | does not match the strict standard format: %thing% is deprecated in %deprecation-version% and is removed from %removal-version%. %extra-info%. See %cr-link%
     80 | ERROR | The text '@deprecated Use Drupal\codemirror_editor\CodemirrorModeManagerInterface::normalizeMode() instead.' does not match the standard format: @deprecated in
        |       | %deprecation-version% and is removed from %removal-version%. %extra-info%.
     80 | ERROR | Each @deprecated tag must have a @see tag immediately following it
     85 | ERROR | The trigger_error message 'codemirror_editor_load_modes() is deprecated. Use Drupal\codemirror_editor\CodemirrorModeManagerInterface::normalizeMode() instead' does
        |       | not match the strict standard format: %thing% is deprecated in %deprecation-version% and is removed from %removal-version%. %extra-info%. See %cr-link%
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/Q2_DO/q2_issues/web/modules/contrib/codemirror_editor/src/CodeMirrorLibraryBuilder.php
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | The text '@deprecated Use \Drupal\codemirror_editor\LibraryBuilder' does not match the standard format: @deprecated in %deprecation-version% and is removed from
       |       | %removal-version%. %extra-info%.
     8 | ERROR | Each @deprecated tag must have a @see tag immediately following it
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 610ms; Memory: 12MB

    Thank you.

  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 28 days ago
    14 pass
  • Pipeline finished with Failed
    28 days ago
    Total: 202s
    #186884
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Status changed to Needs review 28 days ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 28 days ago
    14 pass
  • Pipeline finished with Failed
    28 days ago
    Total: 258s
    #186900
Production build 0.69.0 2024