Problem/Motivation
In #2719663: Fix 'Drupal.Commenting.InlineComment.InvalidEndChar' coding standard we are trying to implement "Drupal.Commenting.InlineComment.InvalidEndChar", but we run in to some troubles.
Currently the sniff requires either a full-stops, exclamation marks, question marks, colons, or closing parentheses after the //cspell: inline comment.
We use //cspell: to instruct our spelling checker to ignore certain words or lines.
It should not be required to have a full-stop/whatever at the end of these inline comments
Steps to reproduce
Snippet from core/tests/Drupal/Tests/Component/Utility/XssTest.php
<?php
namespace Drupal\Tests\Component\Utility;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Component\Utility\Xss;
use PHPUnit\Framework\TestCase;
// cspell:ignore ascript barbaz ckers cript CVEs dynsrc fooÿñ metacharacters
// cspell:ignore msgbox ncript nfocus nmedi nosuchscheme nosuchtag onmediaerror
// cspell:ignore scrscriptipt tascript vbscript
when sniffed comes back with:
----------------------------------------------------------------------
11 | ERROR | [x] Inline comments must end in full-stops, exclamation
| | marks, question marks, colons, or closing
| | parentheses
----------------------------------------------------------------------
Proposed resolution
Fix the Drupal.Commenting.InlineComment.InvalidEndChar in such a way that inline comments starting with //cspell: are ignored by this sniff
Remaining tasks
https://github.com/pfrenssen/coder/pull/152
Comments
Comment #2
spokjeComment #3
spokjeComment #5
klausiMakes perfect sense to me, thanks a lot!