WordPress / WordPress/WordPress-Coding-Standards

Squiz.Commenting.InlineComment.InvalidEndChar triggers on translators comment

Open
#1,723 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Docs Focus: I18n Status: Awaiting feedback
Dominant language
PHP
Stars
2.8k
Forks
521
Avg merge
5d 20h
Merged PRs (30d)
1

Description

Bug Description

When I have a "translators" comment, phpcs complains about it not ending in a period. IMHO, this doesn't really make sense as translators comments are not regular comments and they are in my case usually not sentences, so they shouldn't need to end with a period

Minimal Code Snippet

// translators: 1: Start of link to the settings 2: End of link to the settings

For bugs with fixers: How was the code fixed? How did you expect the code to be fixed?

Error Code

 88 | ERROR | Inline comments must end in full-stops, exclamation marks, or question marks
    |       | (Squiz.Commenting.InlineComment.InvalidEndChar)

Environment

Question Answer
PHP version 7.3
PHP_CodeSniffer version 3.4.2
WPCS version 2.1.1
WPCS install type Composer project local

Tested Against develop branch?

  • I have verified the issue still exists in the develop branch of WPCS.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported error using the PHP snippet and inspect the Squiz.Commenting.InlineComment.InvalidEndChar rule, including how it handles translators comments. Done means the translators comment no longer receives this punctuation error while regular inline-comment validation remains covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.