Running shows the following errors/warnings, which should be fixed, when they are not false positive nor they suggest wrong changes.

FILE: ./default_paragraphs/default_paragraphs.module
-------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
-------------------------------------------------------------------------
  1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
  7 | ERROR | [x] When importing a class with "use", do not include a leading \
 14 | ERROR | [x] There must be no space before the colon in a CASE statement
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------


FILE: ./default_paragraphs/src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php
-------------------------------------------------------------------------
FOUND 8 ERRORS AND 5 WARNINGS AFFECTING 12 LINES
-------------------------------------------------------------------------
  11 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is
     |         |     Drupal\Core\Field\FieldItemListInterface.
  57 | ERROR   | [ ] Parameter $token_service is not described in comment
  74 | ERROR   | [x] Doc comment parameter name "$token_service." must not end with a dot
 206 | ERROR   | [x] Expected one space after the comma, 2 found
 206 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 207 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
 245 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 253 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 268 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 286 | WARNING | [ ] Unused variable $key.
 293 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
     |         |     $this->t() instead
 295 | WARNING | [x] A comma should follow the last multiline array item. Found: $cardinality
 361 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------

Time: 186ms; Memory: 12MB
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

Sahana _N created an issue. See original summary.

sahana _n’s picture

StatusFileSize
new2.52 KB

Please review the patch.

sahana _n’s picture

Status: Active » Needs review
suresh prabhu parkala’s picture

StatusFileSize
new3.94 KB
new1.33 KB

Found some more phpcs errors and solved them. Here is the updated patch.

dharti patel’s picture

Assigned: Unassigned » dharti patel
dharti patel’s picture

Assigned: dharti patel » Unassigned
StatusFileSize
new6.13 KB

Hello,

Reviewed the #4 patch and after applying the patch still below issues are remaining.

FILE: /home/drupal/drupal-9.5/drupal/default_paragraphs/src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php
------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------------------------
 245 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 253 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 268 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 286 | WARNING | [ ] Unused variable $key.
 293 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 361 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
------------------------------------------------------------------------------------------------------------------------

Resolved the issue and create a new patch.
Please review the patch.

Thanks!

avpaderno’s picture

Status: Needs review » Needs work
 .field--widget-default-paragraphs th .paragraphs-actions {
-    float: right;
-    margin-right: -11px;
+  float: right;
+  margin-right: -11px;
 }
 
 .field--widget-default-paragraphs .paragraphs-dropbutton-wrapper {
-    display: inline-flex;
+  display: inline-flex;
 }
 
 .field--widget-default-paragraphs .dropbutton-wrapper {
-    width: auto;
-    margin-right: 0;
-    padding-right: 0;
+  width: auto;
+  margin-right: 0;
+  padding-right: 0;
 }
 
 .field--widget-default-paragraphs .dropbutton-widget {
-    position: static;
+  position: static;
 }
 
 .field--widget-default-paragraphs .field-multiple-table {
-    margin-bottom: 10px;
+  margin-bottom: 10px;
 }
 
 .field--widget-default-paragraphs td {
-    padding: 10px 0;
+  padding: 10px 0;
 }
 
 .field--widget-default-paragraphs .field-multiple-drag {
-    vertical-align: top;
+  vertical-align: top;
 }
 
 .field--widget-default-paragraphs .draggable .tabledrag-handle {
-    margin-left: 0;
+  margin-left: 0;
 }
 
 .field--widget-default-paragraphs .tabledrag-handle .handle {
-    height: 22px;
+  height: 22px;
 }
 
 .field--widget-default-paragraphs .delta-order {
-    padding-right: 10px;
-    text-align: right;
+  padding-right: 10px;
+  text-align: right;
 }

Those changes aren't related to the report shown in the issue summary, like other changes present in the last patch.

priyanka_chauhan31’s picture

Assigned: Unassigned » priyanka_chauhan31

Hi, I'm working on it .

priyanka_chauhan31’s picture

Assigned: priyanka_chauhan31 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new6.45 KB

Hi, I have created a patch . Please review it .

avpaderno’s picture

Status: Needs review » Needs work
diff --git a/css/default_paragraphs.widget.css b/css/default_paragraphs.widget.css
index fc6f5b5..282e15b 100644
--- a/css/default_paragraphs.widget.css
+++ b/css/default_paragraphs.widget.css
@@ -1,43 +1,43 @@
 .field--widget-default-paragraphs th .paragraphs-actions {
-    float: right;
-    margin-right: -11px;
+  float: right;
+  margin-right: -11px;
 }
 
 .field--widget-default-paragraphs .paragraphs-dropbutton-wrapper {
-    display: inline-flex;
+  display: inline-flex;
 }
 

The report shown in the issue summary is for PHP files, not .css files.

priyanka_chauhan31’s picture

Status: Needs work » Needs review
StatusFileSize
new5.03 KB

Hi, I have excluded the css files from this patch. Please review it.

avpaderno’s picture

Title: Phpcs coding standard » Fix what reported by phpcs
Category: Bug report » Task
Status: Needs review » Needs work
+// Use \Drupal\Core\StringTranslation\StringTranslationTrait;.

Either that trait is used, and the use statement is necessary, or that trait is not used and the use statement is not necessary.

priyanka_chauhan31’s picture

Status: Needs work » Needs review
StatusFileSize
new4.71 KB

Use statement has been removed. Please review this new patch.

avpaderno’s picture

Status: Needs review » Reviewed & tested by the community

The patch fixes what reported.

Nikolay Penchev made their first commit to this issue’s fork.

avpaderno’s picture

Title: Fix what reported by phpcs » Fix the errors/warnings reported by PHP_CodeSniffer
Status: Reviewed & tested by the community » Needs work
Issue tags: +Coding standards

Nikolay Penchev’s picture

Version: 8.x-1.x-dev » 2.x-dev
Status: Needs work » Reviewed & tested by the community

Tested and verified , ready for merge .

avpaderno’s picture

Status: Reviewed & tested by the community » Needs review

The person who provided the patch/MR cannot change the status to Reviewed & tested by the community.

avpaderno’s picture

Issue summary: View changes
nikolabintev’s picture

I tested the issue fork locally. It seems like all issues are fixed.

nikolabintev’s picture

Status: Needs review » Reviewed & tested by the community

nikolabintev’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.