Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Items:
FILE: ...modules/xmlsitemap/xmlsitemap_custom/xmlsitemap_custom.admin.inc
----------------------------------------------------------------------
FOUND 7 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
----------------------------------------------------------------------
8 | ERROR | [x] Missing function doc comment
65 | ERROR | [x] Missing function doc comment
119 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: 'actions'
134 | ERROR | [x] Missing function doc comment
146 | WARNING | [ ] Line exceeds 80 characters; contains 84
| | characters
151 | ERROR | [ ] If the line declaring an array spans longer than
| | 80 characters, each element should be broken
| | into its own line
161 | ERROR | [x] Missing function doc comment
168 | ERROR | [x] Missing function doc comment
192 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: .../all/modules/xmlsitemap/xmlsitemap_custom/xmlsitemap_custom.info
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
6 | ERROR | It's only necessary to declare files[] if they declare a
| | class or interface.
7 | ERROR | It's only necessary to declare files[] if they declare a
| | class or interface.
8 | ERROR | It's only necessary to declare files[] if they declare a
| | class or interface.
----------------------------------------------------------------------
FILE: ...ll/modules/xmlsitemap/xmlsitemap_custom/xmlsitemap_custom.module
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
45 | ERROR | [ ] Missing parameter type
----------------------------------------------------------------------
FILE: .../all/modules/xmlsitemap/xmlsitemap_custom/xmlsitemap_custom.test
----------------------------------------------------------------------
FOUND 17 ERRORS AND 4 WARNINGS AFFECTING 13 LINES
----------------------------------------------------------------------
8 | ERROR | [x] Missing class doc comment
9 | ERROR | [x] Missing function doc comment
9 | ERROR | [x] Expected 1 blank line before function; 0 found
17 | ERROR | [x] Missing function doc comment
17 | ERROR | [x] Visibility must be declared on method "setUp"
26 | ERROR | [x] Missing function doc comment
26 | ERROR | [x] Visibility must be declared on method
| | "testCustomLinks"
60 | ERROR | [ ] If the line declaring an array spans longer than
| | 80 characters, each element should be broken
| | into its own line
69 | ERROR | [ ] If the line declaring an array spans longer than
| | 80 characters, each element should be broken
| | into its own line
80 | ERROR | [x] Visibility must be declared on method
| | "testCustomFileLinks"
88 | ERROR | [x] No space found before comment text; expected "//
| | $edit['loc'] = '.htaccess';" but found
| | "//$edit['loc'] = '.htaccess';"
89 | WARNING | [ ] Line exceeds 80 characters; contains 87
| | characters
89 | ERROR | [x] No space found before comment text; expected "//
| | $this->drupalPost('admin/config/search/xmlsitemap/custom/add',
| | $edit, t('Save'));" but found
| | "//$this->drupalPost('admin/config/search/xmlsitemap/custom/add',
| | $edit, t('Save'));"
90 | WARNING | [ ] Line exceeds 80 characters; contains 147
| | characters
90 | ERROR | [x] No space found before comment text; expected "//
| | $this->assertText(t('The custom link @link is
| | either invalid or it cannot be accessed by
| | anonymous users.', array('@link' =>
| | $edit['loc'])));" but found
| | "//$this->assertText(t('The custom link @link is
| | either invalid or it cannot be accessed by
| | anonymous users.', array('@link' =>
| | $edit['loc'])));"
91 | WARNING | [ ] Line exceeds 80 characters; contains 83
| | characters
91 | WARNING | [x] There must be no blank line following an inline
| | comment
91 | ERROR | [x] No space found before comment text; expected "//
| | $this->assertNoSitemapLink(array('type' =>
| | 'custom', 'loc' => $edit['loc']));" but found
| | "//$this->assertNoSitemapLink(array('type' =>
| | 'custom', 'loc' => $edit['loc']));"
91 | ERROR | [x] Inline comments must end in full-stops,
| | exclamation marks, colons, question marks, or
| | closing parentheses
106 | ERROR | [x] Expected 1 blank line after function; 0 found
107 | ERROR | [x] The closing brace for the class must have an
| | empty line before it
----------------------------------------------------------------------
Proposed resolution
Fixed items following Drupal Coding Standards and https://www.drupal.org/docs/7/site-building-best-practices/best-practices
Remaining tasks
None
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#2 | fix_drupal_coding-2906634-2.patch | 9.22 KB | renatog |
Comments
Comment #2
renatogPatch with the fix it's in the attachment.
Regards.
Comment #4
renatogFixed.
Committed to the dev branch.
Regards.
Comment #6
ciss CreditAttribution: ciss at yousign GmbH commented@RenatoG Minor nitpick: The updated docblock now reads:
I assume this should be: