There's a handful of phpcs issues to be fixed.

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

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/comment.module
--------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------
222 | WARNING | There must be no blank line following an inline comment
--------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/CommentTypeForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 10 WARNINGS AFFECTING 10 LINES
------------------------------------------------------------------------------------------------------------------------------------------
78 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
96 | 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
112 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
114 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
121 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
128 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
148 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
163 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
168 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/CommentTypeListBuilder.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
32 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
33 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/Entity/Comment.php
----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------
113 | WARNING | There must be no blank line following an inline comment
----------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
32 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
36 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
37 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
38 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
41 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
44 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
47 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
56 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 13 WARNINGS AFFECTING 13 LINES
------------------------------------------------------------------------------------------------------------------------------------------
111 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
113 | 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
125 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
128 | 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
130 | 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
141 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
144 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
145 | 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
188 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/CommentForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
82 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
384 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/CommentStorage.php
----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------
160 | WARNING | There must be no blank line following an inline comment
----------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/CommentLazyBuilders.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------------------------------------------
173 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
180 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
186 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
197 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
209 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/CommentTranslationHandler.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------------
33 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /Applications/MAMP/htdocs/drupal-9-dev/core/modules/comment/src/CommentStatistics.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
166 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
182 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------

Comments

Hardik_Patel_12 created an issue. See original summary.

hardik_patel_12’s picture

Title: Drupal standardserror in comment module » Fix Drupal standards error in comment module
Issue summary: View changes
avpaderno’s picture

Status: Needs work » Active

Since there isn't any patch, the status is still Active.

longwave’s picture

I can't find a change record or documentation for it but I thought that we should no longer call t() in test assertion messages as we never translate these messages and we aren't testing the translation system directly, so I think a lot of these calls should be removed rather than converted.

hardik_patel_12’s picture

Please correct me if i understand wrong that you trying to suggest that we should remove all t() call in test assertion messages

hardik_patel_12’s picture

StatusFileSize
new90.52 KB

Kindly review a patch.

hardik_patel_12’s picture

Assigned: hardik_patel_12 » Unassigned
Status: Active » Needs review
hardik_patel_12’s picture

Issue summary: View changes
hardik_patel_12’s picture

StatusFileSize
new18.01 KB

Kindly review a new patch.

longwave’s picture

  1. +++ b/core/modules/comment/src/CommentStorage.php
    @@ -158,7 +158,6 @@ public function getNewCommentPageNumber($total_comments, $new_comments, Fieldabl
           // Threaded comments.
    -
           // 1. Find all the threads with a new comment.
    

    I don't think we should be removing these blank lines, they are useful to separate the comments.

  2. +++ b/core/modules/comment/src/Entity/Comment.php
    @@ -111,7 +111,6 @@ public function preSave(EntityStorageInterface $storage) {
               // This is a comment with a parent comment, so increase the part of
               // the thread value at the proper depth.
    -
               // Get the parent comment:
    

    Same here.

hardik_patel_12’s picture

StatusFileSize
new16.87 KB
new1.21 KB

Removing spaces as suggested above, kindly review a new patch.

The last submitted patch, 9: 3109146-9.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 11: 3109146-11.patch, failed testing. View results

hardik_patel_12’s picture

StatusFileSize
new15.25 KB
new1.77 KB

Kindly review a new patch.

hardik_patel_12’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 14: 3109146-14.patch, failed testing. View results

hardik_patel_12’s picture

StatusFileSize
new12.89 KB
new2.56 KB

Kindly review a new patch.

hardik_patel_12’s picture

Status: Needs work » Needs review
hash6’s picture

Assigned: Unassigned » hash6
naresh_bavaskar’s picture

Assigned: hash6 » naresh_bavaskar
avpaderno’s picture

Assigned: naresh_bavaskar » Unassigned
naresh_bavaskar’s picture

Status: Needs review » Needs work

There are some more coding standards that need to fixed in this module.

prabha1997’s picture

Assigned: Unassigned » prabha1997

I am working on this issue

prabha1997’s picture

Assigned: prabha1997 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new5.68 KB
new18.02 KB

Status: Needs review » Needs work

The last submitted patch, 24: 3109146-24.patch, failed testing. View results

kishor_kolekar’s picture

StatusFileSize
new4.1 KB
new15.41 KB

please review the patch

kishor_kolekar’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 26: 3109146-26.patch, failed testing. View results

neelam_wadhwani’s picture

Assigned: Unassigned » neelam_wadhwani
neelam_wadhwani’s picture

StatusFileSize
new16.75 KB
new16.75 KB
neelam_wadhwani’s picture

Assigned: neelam_wadhwani » Unassigned
Status: Needs work » Needs review
neelam_wadhwani’s picture

StatusFileSize
new15.58 KB
new15.58 KB

There were small changes because of which patch was getting failed.
Updated the changes.

naresh_bavaskar’s picture

Assigned: Unassigned » naresh_bavaskar
naresh_bavaskar’s picture

Assigned: naresh_bavaskar » Unassigned
Status: Needs review » Needs work
StatusFileSize
new381.1 KB

I found some coding standards that still need to be fixed.

neelam_wadhwani’s picture

Assigned: Unassigned » neelam_wadhwani
xjm’s picture

Status: Needs work » Closed (won't fix)

Thank you for your work on cleaning up Drupal core's code style!

In order to fix core coding standards in a maintainable way, all our coding standards issues should be done on a per-rule basis across all of core, rather than fixing standards in individual modules or files. We should also separate fixes where we need to write new documentation from fixes where we need to correct existing standards. This all should be done as part of #2571965: [meta] Fix PHP coding standards in core, stage 1. A good place to start is the child issues of #2572645: [Meta] Fix 'Drupal.Commenting.FunctionComment' coding standard.

For background information on why we usually will not commit coding standards fixes that aren't scoped in that way, see the core issue scope guidelines, especially the note about coding standards cleanups. That document also includes numerous suggestions for scoping issues including documentation coding standards cleanups.

Contributing to the overall plan above will help ensure that your fixes for core's coding standards remain in core the long term.

Since this issue is a hodgepodge of many different standards for a single module, I'm closing it as wontfix. I encourage you to collaborate on other coding standards cleanups that fix a single rule across all of core according to the scoping guidelines. Thanks!