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

User interface changes

API changes

Data model changes

Comments

Spokje created an issue. See original summary.

spokje’s picture

Version: 8.3.12 » 8.x-3.x-dev
Issue summary: View changes
spokje’s picture

Issue summary: View changes
Status: Active » Needs review

  • cab1d0b committed on 8.3.x
    feat(InlineComment): cspell configuration comments don't need to end in...
klausi’s picture

Status: Needs review » Fixed

Makes perfect sense to me, thanks a lot!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.