Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/publishing_dropbutton/tests/src/Functional/NodeFormButtonsTest.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 16 WARNINGS AFFECTING 17 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
45 | ERROR | [x] Missing function doc comment
49 | ERROR | [ ] The array declaration extends to column 99 (the limit is 80). The array content should be split up over multiple lines
51 | ERROR | [ ] The array declaration extends to column 89 (the limit is 80). The array content should be split up over multiple lines
64 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
64 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
70 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
78 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
78 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
82 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
90 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
97 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
97 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
105 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
110 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
119 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
129 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
146 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
146 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
153 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
186 | ERROR | [x] Expected 1 blank line after function; 2 found
189 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/publishing_dropbutton/tests/src/Functional/ModerationFormTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 15 WARNINGS AFFECTING 15 LINES
------------------------------------------------------------------------------------------------------------------------------------------
59 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
83 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
100 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
117 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
136 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
157 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
166 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
175 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
190 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
208 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
227 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
236 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
247 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
268 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
281 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/publishing_dropbutton/publishing_dropbutton.module
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
12 | WARNING | [x] Unused use statement
24 | ERROR | [ ] The array declaration extends to column 96 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/publishing_dropbutton/src/Plugin/Field/FieldWidget/ModerationStateWidget.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------
78 | ERROR | [x] Parameter comment must end with a full stop
120 | ERROR | [x] Data types in @var tags need to be fully namespaced
212 | ERROR | [ ] The array declaration extends to column 95 (the limit is 80). The array content should be split up over multiple lines
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/publishing_dropbutton/src/NodePublishingDropbutton.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 9 WARNINGS AFFECTING 7 LINES
------------------------------------------------------------------------------------------------------------------------------
24 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
25 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
26 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
27 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters
28 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
28 | WARNING | [x] There must be no blank line following an inline comment
28 | WARNING | [ ] There must be no blank line following an inline comment
28 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
32 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters
45 | WARNING | [ ] Line exceeds 80 characters; contains 93 characters
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------

Time: 1.63 secs; Memory: 6MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/publishing_dropbutton/

Proposed resolution

Above error/warnings need to be fixed.

Command icon 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

samit.310@gmail.com created an issue. See original summary.

samitk’s picture

Assigned: samitk » Unassigned
Status: Needs work » Needs review
StatusFileSize
new18.19 KB

Above error/warnings are fixed.

hardikpandya’s picture

Status: Needs review » Reviewed & tested by the community

I have checked the patch is applying and there are no more phpcs issues reported. Marking as RTBC!

avpaderno’s picture

Title: Drupal Coding Standards Issues | phpcs » Fix the issues reported by phpcs
Priority: Normal » Minor
Status: Reviewed & tested by the community » Needs work
Issue tags: -, -
-      // isNew | prev status » default   & publish label             & unpublish label
-      // 1     | 1           » publish   & Save and publish          & Save as unpublished
-      // 1     | 0           » unpublish & Save and publish          & Save as unpublished
-      // 0     | 1           » publish   & Save and keep published   & Save and unpublish
-      // 0     | 0           » unpublish & Save and keep unpublished & Save and publish
-
+      // isNew | prev status »
+      // default   & publish label             & unpublish label
+      // 1     | 1           »
+      // publish   & Save and publish          & Save as unpublished
+      // 1     | 0           »
+      // unpublish & Save and publish          & Save as unpublished
+      // 0     | 1           »
+      // publish   & Save and keep published   & Save and unpublish
+      // 0     | 0           »
+      // unpublish & Save and keep unpublished & Save and publish.
       // Add a "Publish" button.

Since that data is shown in a tabular format, the existing code is much more readable. Code lines are allowed to exceed 80 characters.

nitin_lama’s picture

Assigned: Unassigned » nitin_lama
nitin_lama’s picture

Status: Needs work » Needs review

Please review.

nitin_lama’s picture

Assigned: nitin_lama » Unassigned
roberttabigue’s picture

Status: Needs review » Needs work
StatusFileSize
new725.66 KB
new212.6 KB

Hi,

I'm still seeing PHPCS errors after applying the latest Merge to the Publishing Dropbutton module with version 8.x-1.x-dev and with Drupal core version 9.5.8.

Marking this as Needs work for now.
Kindly refer to the attached screenshots, please.

sakthi_dev made their first commit to this issue’s fork.

sakthi_dev’s picture

Status: Needs work » Needs review

Please review.

roberttabigue’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new79.18 KB

Hi @sakthi_dev,

Confirmed it resolves the PHPCS errors after applying your latest commit to the Publishing Drop Button module version 8.x-1.x-dev and with Drupal core version 9.5.8.

Marking this now as RTBC,
Thank you!

avpaderno’s picture

Status: Reviewed & tested by the community » Needs work
nitin_lama’s picture

Assigned: Unassigned » nitin_lama
nitin_lama’s picture

Status: Needs work » Needs review
nitin_lama’s picture

Assigned: nitin_lama » Unassigned
larowlan’s picture

Status: Needs review » Closed (duplicate)

Thanks folks - marking this as a duplicate of #3463893: Add gitlabci

Not transferring credit because I don't give credit for PHPCS issues for those who already have such credits, these are great first issues, but not for established contributors.