Fix the issues reported by phpcs

Created on 30 March 2023, over 1 year ago
Updated 20 January 2024, 10 months ago

Problem/Motivation

C:\xampp\htdocs\backendassignment\web\modules\contrib>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig node_protector-3351258

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\node_protector-3351258\config\install\node_protector.settings.yml
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\node_protector-3351258\node_protector.info.yml
-----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" 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: C:\xampp\htdocs\backendassignment\web\modules\contrib\node_protector-3351258\node_protector.module
----------------------------------------------------------------------------------------------------------------------------
FOUND 22 ERRORS AFFECTING 18 LINES
----------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
6 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
7 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
8 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
9 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
10 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
11 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
15 | ERROR | [x] There must be no blank lines after the function comment
18 | ERROR | [x] Whitespace found at end of line
19 | ERROR | [x] Whitespace found at end of line
23 | ERROR | [x] Whitespace found at end of line
28 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
30 | ERROR | [x] Whitespace found at end of line
31 | ERROR | [x] Whitespace found at end of line
32 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
34 | ERROR | [x] Whitespace found at end of line
39 | ERROR | [x] Whitespace found at end of line
40 | ERROR | [x] Inline comments must start with a capital letter
40 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
40 | ERROR | [x] Comments may not appear after statements
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 22 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\node_protector-3351258\node_protector.routing.yml
-------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
16 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\node_protector-3351258\src\Controller\NodeProtectorController.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AND 1 WARNING AFFECTING 9 LINES
-----------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
4 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
5 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
6 | ERROR | [x] Perl-style comments are not allowed; use "// Comment" instead
9 | ERROR | [x] You must use "/**" style comments for a class comment
10 | ERROR | [x] Missing function doc comment
10 | ERROR | [x] Expected 1 blank line before function; 0 found
11 | ERROR | [x] Short array syntax must be used to define arrays
12 | WARNING | [x] A comma should follow the last multiline array item. Found: 'Welcome to Node Protector.'
15 | ERROR | [x] Expected 1 newline at end of file; 0 found
15 | ERROR | [x] The closing brace for the class must have an empty line before it
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\node_protector-3351258\src\Form\NodeProtectorSettingsForm.php
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AND 3 WARNINGS AFFECTING 9 LINES
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
81 | ERROR | [x] Whitespace found at end of line
92 | WARNING | [x] There must be no blank line following an inline comment
92 | WARNING | [ ] There must be no blank line following an inline comment
92 | ERROR | [x] No space found before comment text; expected "// $config->set('node_protector_frontpage', $front_page);" but found "//$config->set('node_protector_frontpage', $front_page);"
93 | ERROR | [x] Whitespace found at end of line
97 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
97 | ERROR | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
100 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
109 | ERROR | [x] Whitespace found at end of line
111 | ERROR | [x] Expected 1 space after comma in argument list; 7 found
111 | ERROR | [x] Expected one space after the comma, 7 found
112 | ERROR | [x] Expected 1 space after comma in argument list; 6 found
112 | ERROR | [x] Expected one space after the comma, 6 found
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 751ms; Memory: 6MB

Steps to reproduce

Run phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India sidharth_soman 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.

Sign in to follow issues

Comments & Activities

  • Issue created by @sidharth_soman
  • 🇮🇳India sidharth_soman Bangalore

    Working on fixing the above issues.

  • @sidharth_soman opened merge request.
  • 🇮🇳India sidharth_soman Bangalore

    Created an MR for the same. Please review.

  • Issue was unassigned.
  • 🇵🇭Philippines paraderojether

    Hi sidharth_soman

    I reviewed MR!1 and the previous issues are fixed. However, I'm getting new errors and warnings shown below:

    FILE: /Users/studenttrainees/New/drupalorgsite/docroot/modules/contrib/node_protector/node_protector.module
    -----------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
    17 | WARNING | There must be no blank line following an inline comment
    -----------------------------------------------------------------------------------------------------------

    FILE: ...enttrainees/New/drupalorgsite/docroot/modules/contrib/node_protector/src/Form/NodeProtectorSettingsForm.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
    96 | WARNING | Translatable strings must not begin or end with white spaces, use placeholders with t() for
    | | variables
    96 | ERROR | Concatenating translatable strings is not allowed, use placeholders instead and only one string
    | | literal
    -----------------------------------------------------------------------------------------------------------------

    FILE: ...rainees/New/drupalorgsite/docroot/modules/contrib/node_protector/src/Controller/NodeProtectorController.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
    8 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph
    -----------------------------------------------------------------------------------------------------------------

    Time: 304ms; Memory: 10MB

    Please check.
    Thank You.

  • First commit to issue fork.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sakthi_dev

    Please review.

  • Status changed to RTBC over 1 year ago
  • 🇮🇳India Anmol_Specbee

    The patch is working as expected, Moving to RTBC.

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • First commit to issue fork.
  • Status changed to Needs review over 1 year ago
  • Status changed to Fixed over 1 year ago
  • 🇮🇩Indonesia drupalnesia

    All errors related to PHPCS fixed on 1.0.4 today, thanks all.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Needs review over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    This was not fixed. In fact, the node_protector.info.yml file contains the following lines.

    name: Node Protector
    description: Protect node from Delete.
    package: Administration
    type: module
    core_version_requirement: ^8 || ^9 || ^10
    dependencies:
    version: '1.0.2'
    project: 'node_protector'
    

    That is its content in either the 1.0.x branch or the 1.0.4 tag.

  • Status changed to Fixed 11 months ago
  • 🇮🇩Indonesia drupalnesia
    name: Node Protector
    description: Protect node from Delete.
    package: Administration
    type: module
    core_version_requirement: ^8 || ^9 || ^10
    dependencies:
    # version: '1.0.2'
    # project: 'node_protector'
    
    # Information added by Drupal.org packaging script on 2023-05-21
    version: '1.0.4'
    project: 'node_protector'
    datestamp: 1684635367
    
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    1 | WARNING | Remove "project" 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
    

    Those lines have not been removed from the node_protector.info.yml file.

    name: Node Protector
    description: Protect node from Delete.
    package: Administration
    type: module
    core_version_requirement: ^8 || ^9 || ^10
    dependencies:
    version: '1.0.2'
    project: 'node_protector'
    
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024