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.
Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig
shows the following warnings/errors that needs to be fixed.
FILE: ./entity_browser_8.x-2.x/tests/fixtures/update/entity_browser.update-hook-test.php 4 | ERROR | [x] Doc comment short description must be on the first line 85 | ERROR | [ ] unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the | | allowed_classes option. FILE: ./entity_browser_8.x-2.x/tests/modules/entity_browser_test/entity_browser_test.routing.yml 7 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction FILE: ./entity_browser_8.x-2.x/tests/modules/entity_browser_test/src/Form/FormElementTest.php 33 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead 37 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead FILE: ./entity_browser_8.x-2.x/tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php 63 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead FILE: ./entity_browser_8.x-2.x/tests/src/Kernel/Extension/EntityBrowserTest.php 266 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() | | instead 461 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() | | instead 468 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() | | instead FILE: ./entity_browser_8.x-2.x/tests/src/Kernel/Plugin/FieldWidgetDisplayTest.php 70 | ERROR | The array declaration extends to column 97 (the limit is 80). The array content should be split up over multiple | | lines FILE: ./entity_browser_8.x-2.x/tests/src/FunctionalJavascript/ConfigurationTest.php 202 | WARNING | Unused variable $entity_type. FILE: ./entity_browser_8.x-2.x/tests/src/FunctionalJavascript/InlineEntityFormTest.php 424 | ERROR | [x] list(...) is forbidden, use [...] instead. FILE: ./entity_browser_8.x-2.x/tests/src/FunctionalJavascript/FieldWidgetConfigTest.php 153 | WARNING | Line exceeds 80 characters; contains 104 characters FILE: ./entity_browser_8.x-2.x/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php 590 | ERROR | [x] list(...) is forbidden, use [...] instead. FILE: ./entity_browser_8.x-2.x/tests/src/FunctionalJavascript/ParagraphsTest.php 50 | ERROR | The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple | | lines 51 | ERROR | The array declaration extends to column 98 (the limit is 80). The array content should be split up over multiple | | lines FILE: ./entity_browser_8.x-2.x/tests/src/FunctionalJavascript/EntityBrowserTest.php 44 | WARNING | [x] '@TODO Test the edit button.' should match the format '@todo Fix problem X here.' 142 | WARNING | [ ] Unused variable $image2. 186 | WARNING | [ ] Line exceeds 80 characters; contains 96 characters FILE: ./entity_browser_8.x-2.x/tests/src/FunctionalJavascript/CardinalityTest.php 230 | ERROR | The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple | | lines 238 | WARNING | Line exceeds 80 characters; contains 82 characters 306 | ERROR | The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple | | lines 315 | WARNING | Line exceeds 80 characters; contains 82 characters FILE: ./entity_browser_8.x-2.x/tests/src/FunctionalJavascript/EntityBrowserWebDriverTestBase.php 254 | WARNING | Line exceeds 80 characters; contains 83 characters 288 | WARNING | Line exceeds 80 characters; contains 86 characters FILE: ./entity_browser_8.x-2.x/tests/src/FunctionalJavascript/PluginsTest.php 228 | WARNING | [x] 'TODO test if entities were selected. Will most likely need a custom event' should match the format '@todo Fix | | problem X here.' FILE: ./entity_browser_8.x-2.x/tests/src/Functional/EntityBrowserUITest.php 37 | ERROR | Public method name "EntityBrowserUITest::testEntityBrowserUI" is not in lowerCamel format FILE: ./entity_browser_8.x-2.x/tests/src/Functional/FormElementTest.php 73 | ERROR | The array declaration extends to column 151 (the limit is 80). The array content should be split up over multiple | | lines 73 | ERROR | The array declaration extends to column 150 (the limit is 80). The array content should be split up over multiple | | lines FILE: ./entity_browser_8.x-2.x/entity_browser.install 70 | WARNING | Unused variable $entity_type_name. 83 | WARNING | Unused variable $display_name. 85 | WARNING | Unused variable $field_name. FILE: ./entity_browser_8.x-2.x/entity_browser.views.inc 14 | WARNING | Unused variable $entity_type_name. FILE: ./entity_browser_8.x-2.x/modules/entity_form/entity_browser_entity_form.module 32 | WARNING | [x] 'TODO - 'default' might become configurable or something else in the future.' should match the format '@todo | | Fix problem X here.' 83 | WARNING | [x] 'TODO see if we can get away without overriding entire IEF function.' should match the format '@todo Fix | | problem X here.' 106 | WARNING | [ ] Unused variable $key. 121 | WARNING | [x] 'TODO see if we can get away without overriding entire IEF function.' should match the format '@todo Fix | | problem X here.' 158 | ERROR | [ ] The array declaration extends to column 107 (the limit is 80). The array content should be split up over | | multiple lines FILE: ./entity_browser_8.x-2.x/modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php 155 | ERROR | The array declaration extends to column 147 (the limit is 80). The array content should be split up over multiple | | lines 156 | ERROR | The array declaration extends to column 89 (the limit is 80). The array content should be split up over multiple | | lines 156 | ERROR | The array declaration extends to column 166 (the limit is 80). The array content should be split up over multiple | | lines FILE: ./entity_browser_8.x-2.x/src/Ajax/ValueUpdatedCommand.php 17 | ERROR | Class property $details_id should use lowerCamel naming without underscores FILE: ./entity_browser_8.x-2.x/src/Ajax/SelectEntitiesCommand.php 9 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph FILE: ./entity_browser_8.x-2.x/src/WidgetInterface.php 78 | WARNING | Line exceeds 80 characters; contains 83 characters FILE: ./entity_browser_8.x-2.x/src/WidgetBase.php 117 | ERROR | The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple | | lines 332 | ERROR | Parameter $form_state is not described in comment 339 | ERROR | The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple | | lines 359 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph FILE: ./entity_browser_8.x-2.x/src/DisplayBase.php 179 | ERROR | The array declaration extends to column 93 (the limit is 80). The array content should be split up over multiple | | lines FILE: ./entity_browser_8.x-2.x/src/SelectionDisplayBase.php 133 | ERROR | The trigger_error message 'checkPreselectionSupport method is deprecated. Use supportsPreselection instead.' does | | not match the relaxed standard format: %thing% is deprecated in %deprecation-version% any free text | | %removal-version%. %extra-info%. See %cr-link% FILE: ./entity_browser_8.x-2.x/src/Element/EntityBrowserElement.php 257 | ERROR | [x] list(...) is forbidden, use [...] instead. FILE: ./entity_browser_8.x-2.x/src/EntityBrowserInterface.php 53 | ERROR | Parameter $widget_selector is not described in comment 56 | ERROR | Doc comment for parameter $display does not match actual variable name $widget_selector 64 | ERROR | Parameter $selection_display is not described in comment 67 | ERROR | Doc comment for parameter $display does not match actual variable name $selection_display FILE: ./entity_browser_8.x-2.x/src/WidgetSelectorBase.php 28 | ERROR | [ ] Class property $widgets_ids should use lowerCamel naming without underscores 43 | ERROR | [x] Use null coalesce operator instead of ternary operator. FILE: ./entity_browser_8.x-2.x/src/Form/EntityBrowserForm.php 131 | ERROR | The array declaration extends to column 100 (the limit is 80). The array content should be split up over multiple | | lines 152 | ERROR | The array declaration extends to column 109 (the limit is 80). The array content should be split up over multiple | | lines FILE: ./entity_browser_8.x-2.x/src/Form/WidgetsConfig.php 164 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() | | instead FILE: ./entity_browser_8.x-2.x/src/Form/EntityBrowserEditForm.php 17 | WARNING | The class short comment should describe what the class does and not simply repeat the class name 340 | WARNING | Unused variable $plugin_id. FILE: ./entity_browser_8.x-2.x/src/RouteSubscriber.php 50 | WARNING | [x] The variable name should be defined after the type 66 | ERROR | [ ] Protected method name "RouteSubscriber::getBrowserIDsWithRoute" is not in lowerCamel format FILE: ./entity_browser_8.x-2.x/src/Events/EventBase.php 45 | ERROR | Public method name "EventBase::getBrowserID" is not in lowerCamel format 55 | ERROR | Public method name "EventBase::getBrowserInstanceUUID" is not in lowerCamel format FILE: ./entity_browser_8.x-2.x/src/Events/Events.php 12 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph 19 | WARNING | Line exceeds 80 characters; contains 82 characters 20 | WARNING | Line exceeds 80 characters; contains 85 characters 20 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph 27 | WARNING | Line exceeds 80 characters; contains 82 characters 29 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph 36 | WARNING | Line exceeds 80 characters; contains 81 characters 37 | ERROR | Doc comment short description must be on a single line, further text should be a separate paragraph FILE: ./entity_browser_8.x-2.x/src/Events/EntitySelectionEvent.php 35 | ERROR | Description for the @return value is missing FILE: ./entity_browser_8.x-2.x/src/SelectionDisplayInterface.php 69 | ERROR | The text '@deprecated Use ::supportsPreselection instead.' does not match the standard format: @deprecated in | | %deprecation-version% and is removed from %removal-version%. %extra-info%. 69 | ERROR | Each @deprecated tag must have a @see tag immediately following it FILE: ./entity_browser_8.x-2.x/src/Plugin/Field/FieldWidget/FileBrowserWidget.php 101 | ERROR | [ ] Doc comment for parameter $mime_type_guesser does not match actual variable name 370 | ERROR | [ ] The array declaration extends to column 133 (the limit is 80). The array content should be split up over | | multiple lines 389 | ERROR | [ ] The array declaration extends to column 103 (the limit is 80). The array content should be split up over | | multiple lines 406 | ERROR | [ ] The array declaration extends to column 103 (the limit is 80). The array content should be split up over | | multiple lines 505 | ERROR | [x] Use null coalesce operator instead of ternary operator. 511 | ERROR | [ ] The array declaration extends to column 129 (the limit is 80). The array content should be split up over | | multiple lines FILE: ./entity_browser_8.x-2.x/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php 443 | ERROR | [ ] The array declaration extends to column 89 (the limit is 80). The array content should be split up over | | multiple lines 530 | WARNING | [ ] Unused variable $row_id. 610 | ERROR | [ ] The array declaration extends to column 97 (the limit is 80). The array content should be split up over | | multiple lines 810 | ERROR | [ ] The array declaration extends to column 81 (the limit is 80). The array content should be split up over | | multiple lines 919 | WARNING | [x] 'TODO Figure out how to avoid using raw user input.' should match the format '@todo Fix problem X here.' FILE: ./entity_browser_8.x-2.x/src/Plugin/views/display/EntityBrowser.php 133 | ERROR | [x] Use null coalesce operator instead of ternary operator. FILE: ./entity_browser_8.x-2.x/src/Plugin/views/filter/ContextualBundle.php 53 | ERROR | Parameter $selection_storage is not described in comment FILE: ./entity_browser_8.x-2.x/src/Plugin/EntityBrowser/Widget/View.php 93 | WARNING | [x] 'TODO - do we need better error handling for view and view_display (in' should match the format '@todo Fix | | problem X here.' 108 | ERROR | [x] Use null coalesce operator instead of ternary operator. 134 | ERROR | [ ] The array declaration extends to column 149 (the limit is 80). The array content should be split up over | | multiple lines 135 | ERROR | [ ] The array declaration extends to column 130 (the limit is 80). The array content should be split up over | | multiple lines 136 | ERROR | [ ] The array declaration extends to column 127 (the limit is 80). The array content should be split up over | | multiple lines 141 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead 232 | ERROR | [x] list(...) is forbidden, use [...] instead. 260 | ERROR | [x] list(...) is forbidden, use [...] instead. 262 | ERROR | [ ] The array declaration extends to column 170 (the limit is 80). The array content should be split up over | | multiple lines 285 | ERROR | [x] list(...) is forbidden, use [...] instead. 297 | WARNING | [ ] ViewEntity::load calls should be avoided in classes, use dependency injection instead FILE: ./entity_browser_8.x-2.x/src/Plugin/EntityBrowser/Widget/Upload.php 101 | ERROR | The array declaration extends to column 104 (the limit is 80). The array content should be split up over multiple | | lines 102 | ERROR | The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple | | lines 102 | ERROR | The array declaration extends to column 177 (the limit is 80). The array content should be split up over multiple | | lines 157 | WARNING | Line exceeds 80 characters; contains 81 characters FILE: ./entity_browser_8.x-2.x/src/Plugin/EntityBrowser/SelectionDisplay/View.php 41 | WARNING | [x] 'TODO - do we need better error handling for view and view_display' should match the format '@todo Fix problem | | X here.' 52 | WARNING | [x] 'TODO - if there are entities that are selected multiple times this' should match the format '@todo Fix | | problem X here.' 55 | ERROR | [ ] The array declaration extends to column 81 (the limit is 80). The array content should be split up over | | multiple lines 93 | ERROR | [ ] The array declaration extends to column 146 (the limit is 80). The array content should be split up over | | multiple lines 116 | ERROR | [x] list(...) is forbidden, use [...] instead. FILE: ./entity_browser_8.x-2.x/src/Plugin/EntityBrowser/SelectionDisplay/MultiStepDisplay.php 94 | ERROR | The array declaration extends to column 81 (the limit is 80). The array content should be split up over multiple | | lines 205 | ERROR | The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple | | lines 374 | ERROR | The array declaration extends to column 82 (the limit is 80). The array content should be split up over multiple | | lines 401 | ERROR | The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple | | lines FILE: ./entity_browser_8.x-2.x/src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php 83 | ERROR | [x] Expected 1 space after "?"; 2 found 84 | ERROR | [x] Expected 1 space after ":"; 2 found FILE: ./entity_browser_8.x-2.x/src/Plugin/EntityBrowser/FieldWidgetDisplay/ImageThumbnail.php 74 | ERROR | [x] Expected 1 space after "?"; 2 found 75 | ERROR | [x] Expected 1 space after ":"; 2 found FILE: ./entity_browser_8.x-2.x/src/Plugin/EntityBrowser/Display/Standalone.php 48 | WARNING | [ ] Possible useless method overriding detected 50 | WARNING | [x] '@TODO Implement it.' should match the format '@todo Fix problem X here.' 57 | WARNING | [x] '@TODO Implement it.' should match the format '@todo Fix problem X here.' FILE: ./entity_browser_8.x-2.x/src/Entity/EntityBrowser.php 323 | WARNING | [x] 'TODO - this doesn't make much sense. Refactor.' should match the format '@todo Fix problem X here.' 332 | WARNING | [x] 'TODO - this doesn't make much sense. Refactor.' should match the format '@todo Fix problem X here.' 386 | WARNING | [x] 'TODO: Allow displays to define more than just path.' should match the format '@todo Fix problem X here.' FILE: ./entity_browser_8.x-2.x/src/Controllers/EntityBrowserController.php 77 | ERROR | The array declaration extends to column 194 (the limit is 80). The array content should be split up over multiple | | lines FILE: ./entity_browser_8.x-2.x/src/Controllers/EntityBrowserListBuilder.php 33 | WARNING | [x] Inline @var declarations should use the /** */ delimiters FILE: ./entity_browser_8.x-2.x/src/Controllers/EntityBrowserFormController.php 107 | WARNING | [x] Inline @var declarations should use the /** */ delimiters 109 | WARNING | [x] Inline @var declarations should use the /** */ delimiters FILE: ./entity_browser_8.x-2.x/entity_browser.module 81 | ERROR | [ ] The array declaration extends to column 198 (the limit is 80). The array content should be split up over | | multiple lines 148 | ERROR | [x] list(...) is forbidden, use [...] instead. 166 | ERROR | [x] list(...) is forbidden, use [...] instead. FILE: ./entity_browser_8.x-2.x/entity_browser.api.php 14 | WARNING | Line exceeds 80 characters; contains 92 characters 24 | WARNING | Line exceeds 80 characters; contains 91 characters 34 | WARNING | Line exceeds 80 characters; contains 88 characters 44 | WARNING | Line exceeds 80 characters; contains 99 characters 54 | WARNING | Line exceeds 80 characters; contains 103 characters 65 | WARNING | Line exceeds 80 characters; contains 101 characters
Comment | File | Size | Author |
---|---|---|---|
#37 | enitity_browser.patch | 84.51 KB | Shreyas gowda |
#34 | phpcs-3036556-34.patch | 94.6 KB | imustakim |
#34 | interdiff-30-34.txt | 23.81 KB | imustakim |
#30 | phpcs-3036556-30.patch | 82.85 KB | sakthi_dev |
#24 | 3036556-Coding_standards_fixes-24.patch | 74.14 KB | anabpv |
Issue fork entity_browser-3036556
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jigish.addweb CreditAttribution: jigish.addweb at AddWeb Solution Pvt. Ltd. commentedHere's the patch that resolves the error that mentioned above.
Comment #3
oknateThe patch changes many things that shouldn't be changed. Closing for now.
Comment #4
oknateComment #5
oknateComment #6
oknateRe-opening. I see a bunch of "Line exceeds 80 characters" warnings.
I haven't looked closely at the lines in question. I think these were missed because of the way I was linting the code, it was only fixing the ones it could automatically fix, using phpcbf, rather than just outputting a report using phpcs.
Once we fix these, I'll check the code base regularly with phpcs before committing code.
Comment #7
joshi.rohit100Adding for DCD-2019 code sprint.
Comment #8
willtryagain CreditAttribution: willtryagain commentedComment #9
willtryagain CreditAttribution: willtryagain commentedComment #10
sushylComment #11
otrolopezmasRan codesniffer and fixed all issues I found. I solved some of the comment lines, that were longer than 80 character, reducing the first line to an anecdotal version and then inserting the full comment in the following lines, where it's allowed to have multiple lines.
Comment #13
otrolopezmasTests are failing because of parent classes argument hints. Is there a way to fix this? Or this issue needs to be in standby until core is fixed?
Comment #14
nikitagupta CreditAttribution: nikitagupta at Srijan | A Material+ Company for Drupal India Association commentedComment #15
nikitagupta CreditAttribution: nikitagupta at Srijan | A Material+ Company for Drupal India Association commentedUpdate the patch #11 also fixed the test case.
Comment #16
nmatja CreditAttribution: nmatja at Agiledrop - Your Trusted Drupal Teammates commentedUpdated the patch #15.
Comment #17
guilhermevp CreditAttribution: guilhermevp at CI&T commentedComment #18
guilhermevp CreditAttribution: guilhermevp at CI&T commentedSending patch. Testing with phpcs will not return a clean state because some changes would result in worst readability. This patch has no interdiff, but is a sudo-reroll of #16
Comment #19
anabpvI will review this
Comment #20
anabpvI ran Code Sniffer and Code Beautify and fixed:
- 80 characters lines
- Dependency injections
- Access restriction comment
- Unused variables
- t() calls avoidance
- trigger_error for the deprecated method
- Doc comments
- @see message
Awaiting for review.
Thank you!
Comment #21
tmaiochi CreditAttribution: tmaiochi at CI&T commentedI'll review this.
Comment #22
anabpvApologies, I had a syntax error in the patch #20.
Hopefully this new one is correct.
Thank you
Comment #23
anabpvUpdate of patch #22 (another syntax error)
Comment #24
anabpvUpdate of patch #23 (another syntax error)
Comment #25
tmaiochi CreditAttribution: tmaiochi at CI&T commentedSteps performed:
(1) Installed module
(2) Reproduced the issue.
(3) Applied patch.
(4) Code review on changes.
(5) Tested again with patch, issue resolved.
The patch #24 correctly applied all coding standards.
Comment #26
apadernoI am not sure why only the Drupal ruleset is used, when there is also the DrupalPractice ruleset.
Comment #27
apadernoComment #28
Kaustab_Roy CreditAttribution: Kaustab_Roy at Specbee commentedComment #29
apadernoIssues should be assigned to somebody who creates a patch or a MR in the next hours, not after more than 12 hours. This means blocking an issue for which somebody else could have worked on.
Comment #30
sakthi_dev CreditAttribution: sakthi_dev at Specbee for Drupal India Association commentedCreated a patch after verifying with DrupalPractice ruleset with . Please review.
Comment #31
apadernoThe last line is necessary and it should not be removed.
Short descriptions cannot be split like that.
Alter must use the third person singular.
What follows
@todo
is a sentence: It starts with a capitalized word and ends with a period (preferable), a question mark, or an exclamation mark.I am not sure that removing field is correct. The existing comment is about a field, while the changed comment is about a formatted text (which is not a field).
That description is missing a definite article.
That description does not say what the class does.
As per Drupal coding standards, control structure conditions can be written on a single line, if they are more readable. In this case, the existing code is more readable.
The first method cannot be removed, exactly for the same reason the other one has not been removed: It contains a
@todo
tag.That description says for what that property is used; it needs to say what that property contains.
The description for a constructor must start with
Constructs a new
followed by the class name (including its namespace), and end withobject.
plugin_id is not an English word.
It is not necessary to say for the plugin instance, since that is a plugin ID.
The description is missing a definite article.
Only the first word in the description must be capitalized.
There is no need to say service.
That is not the description of what
$render
contains.@deprecated
must be added to the method documentation comment, not inside the method.There is no need to say Drupal.
form_state is not an English word.
Since the property name has been changed,
$this->widget_ids
is setting the wrong property.Comment #32
roshni27 CreditAttribution: roshni27 at Valuebound for Valuebound commentedComment #33
imustakim CreditAttribution: imustakim at Specbee for Drupal India Association commentedComment #34
imustakim CreditAttribution: imustakim at Specbee for Drupal India Association commentedAs per suggestions by @apaderno, Changes have been made, and to address some of the concern mentioned in #31, only these errors are remaining.
Assuming these can be ignored. Rest of the errors are fixed.
Patch is updated, please review.
Comment #37
Shreyas gowda CreditAttribution: Shreyas gowda commentedComment #39
Shruu_rao CreditAttribution: Shruu_rao commentedHi,
I tried applying #37 patch. The patch throws
error: corrupt patch at line 16
Please check.