Coding standards issue

Created on 31 January 2025, about 1 month ago

Problem/Motivation

FILE: /home/kinyein/drupal/contributions/forContributions/web/modules/custom/ewelink/scripts/toggledevice.js
------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Space before opening parenthesis of function call prohibited
10 | ERROR | [x] Whitespace found at end of line
12 | ERROR | [x] Whitespace found at end of line
15 | ERROR | [x] Whitespace found at end of line
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------

FILE: /home/kinyein/drupal/contributions/forContributions/web/modules/custom/ewelink/scripts/devices.js
-------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Space before opening parenthesis of function call prohibited
10 | ERROR | [x] Whitespace found at end of line
15 | ERROR | [x] Whitespace found at end of line
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------

FILE: /home/kinyein/drupal/contributions/forContributions/web/modules/custom/ewelink/scripts/getdevice.js
---------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Space before opening parenthesis of function call prohibited
10 | ERROR | [x] Whitespace found at end of line
12 | ERROR | [x] Whitespace found at end of line
15 | ERROR | [x] Whitespace found at end of line
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------

FILE: /home/kinyein/drupal/contributions/forContributions/web/modules/custom/ewelink/scripts/getdeviceswitch.js
---------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------
5 | ERROR | [x] Space before opening parenthesis of function call prohibited
10 | ERROR | [x] Whitespace found at end of line
12 | ERROR | [x] Whitespace found at end of line
15 | ERROR | [x] Whitespace found at end of line
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------

FILE: /home/kinyein/drupal/contributions/forContributions/web/modules/custom/ewelink/src/Controller/EWeLink.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 87 ERRORS AND 7 WARNINGS AFFECTING 72 LINES
-------------------------------------------------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
6 | WARNING | [x] Unused use statement
7 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
11 | ERROR | [ ] Doc comment is empty
14 | ERROR | [ ] Class name doesn't match filename; expected "class EWeLink"
15 | ERROR | [x] Whitespace found at end of line
16 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 3
16 | ERROR | [x] Whitespace found at end of line
23 | ERROR | [x] Whitespace found at end of line
30 | ERROR | [x] Whitespace found at end of line
31 | ERROR | [x] Whitespace found at end of line
36 | ERROR | [x] Whitespace found at end of line
37 | ERROR | [x] Missing function doc comment
38 | ERROR | [x] Whitespace found at end of line
40 | ERROR | [x] Whitespace found at end of line
41 | ERROR | [x] Missing function doc comment
42 | ERROR | [x] Whitespace found at end of line
46 | ERROR | [x] Whitespace found at end of line
48 | ERROR | [x] Whitespace found at end of line
51 | ERROR | [x] Whitespace found at end of line
55 | ERROR | [x] Whitespace found at end of line
64 | ERROR | [x] Whitespace found at end of line
65 | ERROR | [x] Space before opening parenthesis of function call prohibited
66 | ERROR | [x] Whitespace found at end of line
67 | ERROR | [x] Concat operator must be surrounded by a single space
68 | ERROR | [x] Concat operator must be surrounded by a single space
71 | ERROR | [x] Whitespace found at end of line
72 | ERROR | [x] Whitespace found at end of line
73 | ERROR | [x] Whitespace found at end of line
74 | ERROR | [x] Missing function doc comment
77 | ERROR | [x] Comma not allowed after last value in single-line array declaration
77 | ERROR | [x] Expected one space after the comma, 0 found
77 | ERROR | [x] Whitespace found at end of line
79 | ERROR | [x] Whitespace found at end of line
83 | ERROR | [x] You must use "/**" style comments for a function comment
83 | ERROR | [ ] Private method name "EWelink::from_device_tagid_to_device_id" is not in lowerCamel format
83 | ERROR | [x] Expected 0 spaces before opening parenthesis; 1 found
83 | ERROR | [x] Expected 1 space before opening brace; found 2
83 | ERROR | [x] Whitespace found at end of line
84 | ERROR | [x] Whitespace found at end of line
85 | ERROR | [x] Space before opening parenthesis of function call prohibited
88 | ERROR | [x] Whitespace found at end of line
100 | WARNING | [ ] Empty return statement not required here
102 | ERROR | [x] Whitespace found at end of line
103 | ERROR | [x] Missing function doc comment
111 | ERROR | [x] Whitespace found at end of line
113 | ERROR | [x] There should be no white space before a closing ")"
114 | ERROR | [x] There should be no white space after an opening "("
114 | ERROR | [x] Expected 1 space after closing parenthesis; found 2
115 | ERROR | [x] Space before opening parenthesis of function call prohibited
115 | ERROR | [x] There should be no white space after an opening "("
118 | ERROR | [x] Space before opening parenthesis of function call prohibited
118 | ERROR | [x] There should be no white space after an opening "("
128 | ERROR | [x] Whitespace found at end of line
129 | ERROR | [x] Whitespace found at end of line
131 | ERROR | [x] You must use "/**" style comments for a function comment
131 | ERROR | [x] Expected 0 spaces after opening parenthesis; 1 found
131 | ERROR | [x] There should be no white space after an opening "("
131 | ERROR | [x] There should be no white space before a closing ")"
131 | ERROR | [x] Expected 0 spaces before closing parenthesis; 1 found
132 | ERROR | [x] Whitespace found at end of line
138 | ERROR | [x] Whitespace found at end of line
139 | ERROR | [x] Whitespace found at end of line
141 | ERROR | [x] Whitespace found at end of line
142 | ERROR | [x] Space before opening parenthesis of function call prohibited
143 | ERROR | [x] Whitespace found at end of line
150 | ERROR | [x] Whitespace found at end of line
151 | ERROR | [x] Whitespace found at end of line
152 | ERROR | [x] Missing function doc comment
152 | ERROR | [ ] Public method name "EWelink::ProduceTag" is not in lowerCamel format
152 | ERROR | [x] Expected 0 spaces between argument "$type" and comma; 1 found
154 | ERROR | [x] Whitespace found at end of line
157 | ERROR | [x] Language constructs must be followed by a single space; expected 1 space but found "ยทยท"
166 | ERROR | [x] Whitespace found at end of line
169 | WARNING | [ ] Empty return statement not required here
172 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 3
172 | ERROR | [x] Whitespace found at end of line
173 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
174 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
175 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
176 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
177 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
178 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
178 | ERROR | [x] Whitespace found at end of line
179 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
179 | ERROR | [x] Whitespace found at end of line
180 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
180 | WARNING | [x] '@TODO: implement custom entity to locally manage devices' should match the format '@todo Fix problem X here.'
181 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
181 | ERROR | [x] Whitespace found at end of line
182 | ERROR | [x] Additional blank lines found at end of doc comment
182 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
183 | ERROR | [ ] Private method name "EWelink::StaticListOfDevices" is not in lowerCamel format
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 87 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------

Time: 103ms; Memory: 10MB

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡จ๐Ÿ‡ดColombia kinyein

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

Merge Requests

Comments & Activities

  • Issue created by @kinyein
  • Merge request !2Coding standards fix โ†’ (Merged) created by kinyein
  • ๐Ÿ‡จ๐Ÿ‡ดColombia kinyein

    Hi, I made a merge request to fix the coding standards issue in this module, I hope it can be reviewed soon.

  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi kinyein,

    I checked your MR and applied it in my local, after executing the PHPCS commandd I can still see phpcs issues and warning

    โžœ  ewelink git:(1.0.x) curl https://git.drupalcode.org/project/ewelink/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 11186    0 11186    0     0  18209      0 --:--:-- --:--:-- --:--:-- 18337
    patching file 'scripts/devices.js'
    patching file 'scripts/getdevice.js'
    patching file 'scripts/getdeviceswitch.js'
    patching file 'scripts/toggledevice.js'
    patching file 'src/Controller/EWeLink.php'
    โžœ  ewelink git:(1.0.x) โœ— ..
    โžœ  contrib git:(main) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml ewelink 
    
    FILE: .../drupal-issues/drupal-project/web/modules/contrib/ewelink/ewelink.info.yml
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     4 | ERROR | [x] Expected 1 newline at end of file; 2 found
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...s/drupal-issues/drupal-project/web/modules/contrib/ewelink/ewelink.install
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     1 | ERROR | [x] Expected 1 newline at end of file; 2 found
     1 | ERROR | [x] Missing file doc comment
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...rojects/drupal-issues/drupal-project/web/modules/contrib/ewelink/README.md
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------------
     17 | WARNING | Line exceeds 80 characters; contains 89 characters
     39 | WARNING | Line exceeds 80 characters; contains 136 characters
     47 | WARNING | Line exceeds 80 characters; contains 85 characters
     53 | WARNING | Line exceeds 80 characters; contains 128 characters
    --------------------------------------------------------------------------------
    
    
    FILE: ...ts/drupal-issues/drupal-project/web/modules/contrib/ewelink/ewelink.module
    --------------------------------------------------------------------------------
    FOUND 5 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
    --------------------------------------------------------------------------------
      4 | ERROR   | [x] The second line in the file doc comment must be "@file"
      4 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
        |         |     hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
        |         |     hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
        |         |     Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
        |         |     "* Implements hook_foo_BAR_ID_bar() for block templates."
      5 | ERROR   | [x] There must be no blank lines after the function comment
     12 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
        |         |     hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
        |         |     hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
        |         |     Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
        |         |     "* Implements hook_foo_BAR_ID_bar() for block templates."
     13 | ERROR   | [x] There must be no blank lines after the function comment
     16 | ERROR   | [x] Whitespace found at end of line
     21 | ERROR   | [x] Whitespace found at end of line
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    
    FILE: ...rupal-project/web/modules/contrib/ewelink/src/Form/EwelinkSettingsForm.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     62 | WARNING | t() calls should be avoided in classes, use
        |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
        |         | $this->t() instead
     63 | WARNING | t() calls should be avoided in classes, use
        |         | \Drupal\Core\StringTranslation\StringTranslationTrait and
        |         | $this->t() instead
    --------------------------------------------------------------------------------
    
    
    FILE: ...sues/drupal-project/web/modules/contrib/ewelink/src/Controller/EWeLink.php
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
      96 | WARNING | Unused variable $res.
     101 | WARNING | There must be no blank line following an inline comment
    --------------------------------------------------------------------------------
    
    Time: 281ms; Memory: 10MB
    
    โžœ  contrib git:(main) โœ— 
    
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly afagioli Rome
Production build 0.71.5 2024