Fix the issues reported by phpcs

Created on 26 June 2023, over 1 year ago
Updated 9 September 2024, 3 months 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

Fixed

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 over 1 year ago
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 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

  • šŸ‡®šŸ‡³India sonam_sharma

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

  • Issue was unassigned.
  • 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 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 over 1 year 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 over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary has not yet updated.

  • Assigned to Prachi6824
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India Prachi6824

    Updated issue summary again.

  • Status changed to Needs work over 1 year 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 over 1 year ago
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    14 pass
  • šŸ‡®šŸ‡³India RohitRawat676

    minor change in CodeMirrorEditorWidget.php file.

  • phpcbf --standard=Drupal your_module_directory

  • Status changed to Needs work 7 months 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 7 months ago
    14 pass
  • Pipeline finished with Failed
    7 months ago
    Total: 202s
    #186884
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Status changed to Needs review 7 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 7 months ago
    14 pass
  • Pipeline finished with Failed
    7 months ago
    Total: 258s
    #186900
  • First commit to issue fork.
  • Assigned to Grevil
  • Status changed to Needs work 4 months ago
  • šŸ‡©šŸ‡ŖGermany Grevil

    There are still quite a few phpcs issues left related to incorrect deprecation notices:

    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%.

    All of these deprecations were deprecated 6 years ago, but no "deprecation-version" or "removal-version" was ever given. I'd say, we deprecate them now for 8.x-1.10 and remove them inside a new Drupal 11 "2.x" branch.

  • šŸ‡©šŸ‡ŖGermany Grevil

    All green, talked with @Anybody about these changes internally, so RTBC'ing right away.

    All the given patches were only very minor changes or incorrect, meaning I'll only credit @avpaderno. Sorry y'all.

  • Issue was unassigned.
  • Status changed to RTBC 4 months ago
  • Status changed to Fixed 4 months ago
  • šŸ‡©šŸ‡ŖGermany Grevil
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024