Problem/Motivation

FILE: ...dules/contrib/user_agent_class/src/EventSubscriber/UserAgentSubscriber.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
14 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...n/drupal10/web/modules/contrib/user_agent_class/src/CheckAgentServices.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
9 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...dules/contrib/user_agent_class/src/Controller/CheckUserAgentController.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
11 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...0/web/modules/contrib/user_agent_class/src/CheckAgentServicesInterface.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
7 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...al10/web/modules/contrib/user_agent_class/src/Form/UserAgentEntityForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
10 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...rupal10/web/modules/contrib/user_agent_class/src/Form/DeviceEntityForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
10 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

FILE: ...ion/drupal10/web/modules/contrib/user_agent_class/src/Form/ProvideForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
10 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
--------------------------------------------------------------------------------

Time: 731ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig user_agent_class/

Proposed resolution

Fix the issues for Drupal and DrupalPractice coding standards

Remaining tasks

Patch review.

Comments

urvashi_vora created an issue. See original summary.

avpaderno’s picture

Priority: Normal » Minor
Status: Needs review » Needs work
- * Class CheckAgentServices.
+ * Implements CheckAgentServicesInterface for CheckAgentServices.

Class descriptions must not start with Implements and then repeat the class name and the interface name. That information is already given from the code. What descriptions should do is describing the class purpose or what the class does.

 /**
- * Interface CheckAgentServicesInterface.
+ * Check Agent Services Interface.

That is still repeating the interface name, even if spaces have been added.

 /**
- * Class CheckUserAgentController.
+ * Controller for CheckUserAgentController.
  */

That description is still repeating the class name.

urvashi_vora’s picture

Thanks for the feedback will provide a patch asap.

urvashi_vora’s picture

Status: Needs work » Needs review
StatusFileSize
new2.92 KB
new1.15 KB

Providing the updated patch with suggestions of #2. Please review.
Thanks

avpaderno’s picture

Status: Needs review » Needs work
 /**
- * Class CheckAgentServices.
+ * Service for Checking user agents.
  */

Only the first word in the description must be capitalized.

- * Class UserAgentSubscriber.
+ * Implements EventSubscriberInterface for UserAgentSubscriber.

The description must say what the class purpose is, not which interfaces are implemented by the class or the class name.

 /**
- * Class DeviceEntityForm.
+ * Entity Form for DeviceEntityForm.
  */
 /**
- * Class UserAgentEntityForm.
+ * Entity Form for UserAgentEntityForm.
  */

If those are entity form classes, for should be followed by the entity for which those forms are built.

 /**
- * Class ProvideForm.
+ * Provide Form.
  */
 class ProvideForm extends ConfigFormBase {

That is still repeating the class name, except a space has been put in the middle of the class name. That description does not say what the class does. (Hint: It extends ConfigFormBase.)

urvashi_vora’s picture

Assigned: Unassigned » urvashi_vora

I will provide a patch asap. Assigning it to myself.

Thanks

urvashi_vora’s picture

Assigned: urvashi_vora » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.05 KB
new1.88 KB

Please review the updated patch. Thanks

artsays’s picture

Thank you for your contribution and for fixing class descriptions.
The issue also appeared with ordering in Uses namespaces.
Attached patch and combining with fixes for both issues.
It would be part of new release tag 8.x-6.2

artsays’s picture

Status: Needs review » Reviewed & tested by the community
artsays’s picture

Status: Reviewed & tested by the community » Fixed
artsays’s picture

Status: Fixed » Closed (fixed)