Skip to content

AddCommentService emits '// TODO:' instead of coder-compliant '// @todo' (and audit whether it's still used) #384

Description

@bbrala

Companion to GitLab issue #3313835 (reported by alex.skrypnyk).

Problem

src/Services/AddCommentService.php (line ~41) wraps its notice as:

// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.

Drupal coder's Drupal.Commenting.TodoComment standard expects // @todo ..., so rector's own generated output fails PHPCS on the patched code. It should emit // @todo Drupal Rector Notice: ....

Introduced in https://github.com/palantirnet/drupal-rector/pull/100/files (R44).

Scope of the fix

  • One line in AddCommentService.php (// TODO:// @todo).
  • ~58 fixture files under tests//fixtures/ contain the // TODO: Drupal Rector Notice string in their expected output and would need the same mechanical update.

Also investigate

Before fixing, audit whether AddCommentService (the comment-adding trait/service) is still actually used by current rectors, or whether it's only wired into legacy (D8/D9) rules. If the only consumers are outdated rectors we're no longer maintaining, the right move may be to remove/retire it rather than update 58 fixtures. Determine the live consumers first, then decide: fix the wrapper vs. retire the service.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions