Fix the issues reported by phpcs

Created on 10 July 2023, over 1 year ago
Updated 21 November 2023, about 1 year ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/rest_translation/rest_translation.module
--------------------------------------------------------------------------------
FOUND 11 ERRORS AND 5 WARNINGS AFFECTING 10 LINES
--------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
10 | WARNING | [x] Unused use statement
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
21 | ERROR | [x] 2 spaces found before inline comment; expected "// if
| | (isset($definitions['entity:node'])) {" but found "// if
| | (isset($definitions['entity:node'])) {"
21 | ERROR | [x] Inline comments must start with a capital letter
22 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
22 | ERROR | [ ] Comment indentation error, expected only 2 spaces
23 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
24 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
24 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
25 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
26 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
26 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
27 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
27 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/rest_translation/src/rest_translation.module
--------------------------------------------------------------------------------
FOUND 11 ERRORS AND 5 WARNINGS AFFECTING 10 LINES
--------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
10 | WARNING | [x] Unused use statement
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
21 | ERROR | [x] 2 spaces found before inline comment; expected "// if
| | (isset($definitions['entity:node'])) {" but found "// if
| | (isset($definitions['entity:node'])) {"
21 | ERROR | [x] Inline comments must start with a capital letter
22 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
22 | ERROR | [ ] Comment indentation error, expected only 2 spaces
23 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
24 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
24 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
25 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
26 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
26 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
27 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 0
27 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...nt/rest_translation/src/Plugin/rest/resource/EntityTranslationResource.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
31 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
36 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces,
| | found 3
82 | WARNING | [ ] Possible useless method overriding detected
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 72ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig rest_translation/

Remaining tasks

Patch review

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia urvashi_vora Madhya Pradesh, India

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

Comments & Activities

  • Issue created by @urvashi_vora
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

    Throwing error while applying provided patch.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gautam_105@

    Gautam_105@ โ†’ made their first commit to this issueโ€™s fork.

  • @gautam_105 opened merge request.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gautam_105@

    i have fixed this issue and created MR for the same . Please review and see screenshot as well.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi Gautam,

    I applied your MR !1 and upon executing the PHPCS command it flagged many PHPCS errors/issues.

    โžœ  rest_translation git:(master) โœ— curl https://git.drupalcode.org/project/rest_translation/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2586    0  2586    0     0   4466      0 --:--:-- --:--:-- --:--:--  4544
    patching file rest_translation.module
    patching file 'src/Plugin/rest/resource/EntityTranslationResource.php'
    โžœ  rest_translation git:(master) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml rest_translation 
    
    FILE: ...ing-subing/Projects/d9/d9-local/web/modules/contrib/rest_translation/rest_translation.info.yml
    ----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging
       |         | automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging
       |         | automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging
       |         | automatically
    ----------------------------------------------------------------------------------------------------
    
    
    FILE: ...subing/Projects/d9/d9-local/web/modules/contrib/rest_translation/src/rest_translation.info.yml
    ----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------
     1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging
       |         | automatically
     1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging
       |         | automatically
     1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging
       |         | automatically
    ----------------------------------------------------------------------------------------------------
    
    
    FILE: ...g-subing/Projects/d9/d9-local/web/modules/contrib/rest_translation/src/rest_translation.module
    ----------------------------------------------------------------------------------------------------
    FOUND 11 ERRORS AND 5 WARNINGS AFFECTING 10 LINES
    ----------------------------------------------------------------------------------------------------
      8 | WARNING | [x] Unused use statement
      9 | WARNING | [x] Unused use statement
     10 | WARNING | [x] Unused use statement
     21 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     21 | ERROR   | [x] 2 spaces found before inline comment; expected "// if
        |         |     (isset($definitions['entity:node'])) {" but found "//  if
        |         |     (isset($definitions['entity:node'])) {"
     21 | ERROR   | [x] Inline comments must start with a capital letter
     22 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     22 | ERROR   | [ ] Comment indentation error, expected only 2 spaces
     23 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     24 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
     24 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     25 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     26 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
     26 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     27 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
     27 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks,
        |         |     colons, or closing parentheses
    ----------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------
    
    Time: 223ms; Memory: 10MB
    
    โžœ  contrib git:(master) โœ— 
  • First commit to issue fork.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dharmeshbarot Gujarat
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rudrakumar188

    Hello,
    I was able to reproduce the errors and applied latest MR, most of errors are fixed in all the files but there are still some errors in 'rest_translation.module' file.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dharmeshbarot Gujarat

    Hello @rudrakumar188,

    Can you specify what kind of error you face?

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rudrakumar188

    Hello @dharmeshbarot

    Here's the screenshot of the errors.

Production build 0.71.5 2024