magento / magento/magento-coding-standard

Ignore HTML comments

Open
#482 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Progress: ready for grooming
Dominant language
PHP
Stars
375
Forks
165
PR merge metrics
No merged PRs in 30d

Description

### Preconditions
1. Have a file test.html like this:
```

```

### Steps to reproduce
1. Run `vendor/bin/phpcs -s --standard=Magento2 test.html`

### Expected result
1. Show no errors.

### Actual result
1. Getting this output:
```
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
1 | ERROR | Avoid using self-closing tag with non-void html element - "
| | (Magento2.Html.HtmlSelfClosingTags.HtmlSelfClosingNonVoidTag)
------------------------------------------------------------------------------------------------
```

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 case with vendor/bin/phpcs -s --standard=Magento2 test.html and inspect the Magento2.Html.HtmlSelfClosingTags.HtmlSelfClosingNonVoidTag sniff reported in the output. Confirm that an HTML comment containing a URL produces no error, while the command still reports genuine self-closing-tag violations.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.