Fix the issues reported by phpcs

Created on 20 April 2023, over 1 year ago
Updated 3 August 2023, over 1 year ago

Problem/Motivation

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\random_frontpage\random_frontpage.info.yml
---------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------
1 | WARNING | [ ] Remove "version" from the info file, it will be added by drupal.org packaging automatically
6 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\random_frontpage\random_frontpage.module
----------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 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"
5 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\random_frontpage\random_frontpage.routing.yml
------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
7 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the
| | user can change something - rather than "access administration pages" which is about viewing but not
| | changing configurations.
------------------------------------------------------------------------------------------------------------------------

FILE: ...\xampp\htdocs\backendassignment\web\modules\contrib\random_frontpage\src\Controller\random_frontpageController.php
------------------------------------------------------------------------------------------------------------------------
FOUND 48 ERRORS AND 5 WARNINGS AFFECTING 40 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"
2 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
8 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
12 | WARNING | [x] Unused use statement
17 | WARNING | [x] Unused use statement
20 | ERROR | [x] Doc comment short description must end with a full stop
21 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
23 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
23 | ERROR | [x] Additional blank lines found at end of doc comment
24 | ERROR | [ ] Class name must begin with a capital letter
24 | ERROR | [ ] Class name must use UpperCamel naming without underscores
29 | ERROR | [x] Data types in @var tags need to be fully namespaced
29 | ERROR | [x] Do not append variable name "$config" to the type declaration in a member variable comment
33 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
36 | ERROR | [x] Data types in @var tags need to be fully namespaced
36 | ERROR | [x] Do not append variable name "$renderer" to the type declaration in a member variable comment
43 | ERROR | [x] Data types in @var tags need to be fully namespaced
43 | ERROR | [x] Do not append variable name "$killSwitch" to the type declaration in a member variable comment
50 | ERROR | [x] Data types in @var tags need to be fully namespaced
50 | ERROR | [x] Do not append variable name "$entityTypeManager" to the type declaration in a member variable
| | comment
52 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 3
54 | ERROR | [ ] Missing short description in doc comment
55 | ERROR | [ ] Missing parameter comment
55 | ERROR | [x] Data types in @param tags need to be fully namespaced
56 | ERROR | [ ] Missing parameter comment
56 | ERROR | [x] Data types in @param tags need to be fully namespaced
57 | ERROR | [ ] Missing parameter comment
57 | ERROR | [x] Data types in @param tags need to be fully namespaced
58 | ERROR | [ ] Missing parameter comment
58 | ERROR | [x] Data types in @param tags need to be fully namespaced
60 | ERROR | [x] Additional blank lines found at end of doc comment
72 | ERROR | [ ] Missing short description in doc comment
73 | ERROR | [ ] Missing parameter comment
73 | ERROR | [x] Data types in @param tags need to be fully namespaced
74 | ERROR | [ ] Description for the @return value is missing
75 | ERROR | [x] Data types in @throws tags need to be fully namespaced
76 | ERROR | [x] Data types in @throws tags need to be fully namespaced
78 | ERROR | [x] Additional blank lines found at end of doc comment
91 | ERROR | [ ] Description for the @return value is missing
92 | ERROR | [x] Separate the @return and @throws sections by a blank line.
92 | ERROR | [x] Data types in @throws tags need to be fully namespaced
93 | ERROR | [x] Data types in @throws tags need to be fully namespaced
95 | ERROR | [x] Additional blank lines found at end of doc comment
102 | ERROR | [x] Short array syntax must be used to define arrays
110 | ERROR | [x] Expected newline after closing brace
118 | ERROR | [x] Short array syntax must be used to define arrays
119 | ERROR | [x] Expected newline after closing brace
120 | ERROR | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string
| | literal
121 | ERROR | [x] Short array syntax must be used to define arrays
125 | ERROR | [x] Expected 1 blank line after function; 0 found
126 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 40 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\random_frontpage\src\Form\random_frontpageSettings.php
------------------------------------------------------------------------------------------------------------------------
FOUND 46 ERRORS AFFECTING 33 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"
2 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
12 | ERROR | [x] When importing a class with "use", do not include a leading \
14 | ERROR | [x] Missing class doc comment
14 | ERROR | [ ] Class name must begin with a capital letter
14 | ERROR | [ ] Class name must use UpperCamel naming without underscores
26 | ERROR | [x] Data types in @var tags need to be fully namespaced
26 | ERROR | [x] Do not append variable name "$configFactory" to the type declaration in a member variable comment
30 | ERROR | [ ] Missing short description in doc comment
31 | ERROR | [x] Data types in @var tags need to be fully namespaced
31 | ERROR | [x] Do not append variable name "$entityDisplayRepository" to the type declaration in a member variable
| | comment
33 | ERROR | [x] Additional blank lines found at end of doc comment
39 | ERROR | [ ] Missing parameter comment
39 | ERROR | [x] Data types in @param tags need to be fully namespaced
40 | ERROR | [ ] Missing parameter comment
40 | ERROR | [x] Data types in @param tags need to be fully namespaced
42 | ERROR | [x] Additional blank lines found at end of doc comment
53 | ERROR | [ ] Missing parameter comment
53 | ERROR | [x] Data types in @param tags need to be fully namespaced
54 | ERROR | [x] Separate the @param and @return sections by a blank line.
54 | ERROR | [ ] Description for the @return value is missing
54 | ERROR | [x] Data types in @return tags need to be fully namespaced
56 | ERROR | [x] Additional blank lines found at end of doc comment
67 | ERROR | [ ] Description for the @return value is missing
69 | ERROR | [x] Additional blank lines found at end of doc comment
74 | ERROR | [ ] Missing short description in doc comment
75 | ERROR | [ ] Description for the @return value is missing
77 | ERROR | [x] Additional blank lines found at end of doc comment
81 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
87 | ERROR | [ ] Description for the @return value is missing
89 | ERROR | [x] Additional blank lines found at end of doc comment
102 | ERROR | [ ] Missing parameter comment
103 | ERROR | [ ] Missing parameter comment
103 | ERROR | [x] Data types in @param tags need to be fully namespaced
104 | ERROR | [x] Separate the @param and @return sections by a blank line.
104 | ERROR | [ ] Description for the @return value is missing
106 | ERROR | [x] Additional blank lines found at end of doc comment
109 | ERROR | [x] Short array syntax must be used to define arrays
116 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
118 | ERROR | [x] Short array syntax must be used to define arrays
125 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
132 | ERROR | [ ] Missing parameter comment
133 | ERROR | [ ] Missing parameter comment
133 | ERROR | [x] Data types in @param tags need to be fully namespaced
135 | ERROR | [x] Additional blank lines found at end of doc comment
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 30 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

Time: 935ms; Memory: 6MB

Steps to reproduce

Run phpcs on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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

Comments & Activities

  • Issue created by @sidharth_soman
  • @sidharth_soman opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore

    I've created an MR for solving the phpcs issues. Please review.

  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi sidharth_soman,

    I applied your MR !1 in my local with Drupal 9.5.7 and noticed that there are still phpcs errors and warnings being flagged.

    Please look at the screenshot attached for your reference

    Thank you

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sidharth_soman Bangalore

    @clarkssquared Those are errors related to filling out documentation... which should ideally be resolved by the maintainers themselves. I'll wait for a maintainer to respond and see if I need to fix those as well .

  • 🇺🇸United States earlyburg

    Looks good.
    I will merge the branch.
    Thank you for your contribution.

  • Assigned to earlyburg
  • 🇺🇸United States earlyburg

    These issues are addressed in the latest release found here:
    https://www.drupal.org/project/random_frontpage/releases/2.0.0-beta8
    Please verify and thank you for your help, I appreciate it.

  • Status changed to RTBC over 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi earlyburg,

    I installed the 2.0.0-beta8 version of the module and I verified that the PHPCS issues were indeed addressed and fixed in the latest release.

    Please look at the screenshot attached for your reference.

    Thank you.

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇺🇸United States earlyburg

    @apaderno Please create a branch with the requested changes and I will merge it.
    I manage this codebase locally.
    Thank you.

  • Status changed to Postponed over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇺🇸United States earlyburg

    It is my practice to use a very light hand when dealing with my friends in the open source community. It's easy to assume things about people. I was leaving things as they were to inspire an atmosphere of easy-going cooperation among all of the contributors to the project.

    I had no consensus, no feedback or any cohesion the way that pull request was handled, and honestly I did not really feel like going into a long dialog about small details in the code. I reviewed the original pull request but not all of it I agreed with. I took the responsibility of honoring the contributor by incorporating the changes that were requested, but I did not merge the pull request because I did not want to point out that there were some issues with the English grammer in the HOOK_help() additions in the pull request.

    A lot of my work professonally is developing solutions to the US standard which is enforced by our laws called WCAG 2.0, which requires websites to be handicapped accessable, and translation is incorporated into that law. When I saw the grammer I immidiately thought of the people who would rely on an accurate translation when using a screen reader and translating at the same time.

    Also, because I am an American I felt that I would be judged to be too American-centric if I pointed out the english grammer issue.

    You had no idea this was going on when you updated the pull request but I am mindful also that you did not notice that the latest tag had addressed almost all the issues except the cosmetic ones that you are pointing out.

    I'm doing my best but unless you are volunteering to become a maintainer your changes will have to wait, and I have no intention of merging the pull request - I don't think it would merge anyway because that request is now behind 3 additional commits I have pushed since the pull request was made.

    I'm just trying to be polite and tactfull with a rather awkward situation.
    I apologize for any problems or confusion I might have caused.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    You had no idea this was going on when you updated the pull request

    No, I did not update the pull request; I commented on the pull request from the Gitlab interface. If I updated the pull request, one of the comments shown here would have said added 1 commit.

    I did not ask to merge the pull request. I simply reviewed a pull request done from another person; that's all.

  • Status changed to Closed: duplicate over 1 year ago
Production build 0.71.5 2024