ampproject / ampproject/amphtml

Report more useful line numbers for validator errors that are computed at end of document

Open
#7,414 3 comments 0 reactions 0 assignees View on GitHub
P3: When Possible Stale Type: Bug Validator: Type: Error Messages WG: caching
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

Currently there are several validator rules that are triggered at end of document. These include things like "the presence of tag A requires the presence of tag B" or "tag X is mandatory".

These rules currently return error messages with the line/col number pointing to the end of the AMP document, which may be technically correct, but is not as useful as possible. We would like to map these, when possible, to more useful line numbers.

- "The presence of tag A requires the presence of tag B": When it is determined that tag B is missing, the line number for tag A should be reported.
- "Tag X is mandatory": This should be reported at the end of the enclosing scope for where X was expected. In most cases, this is when we see the closing `` tag.

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests; start by locating validator rules that emit errors at the end of the document and trace how their source locations are selected. Done means missing-tag dependencies report the line of the present required tag, while mandatory-tag errors report the end of the enclosing scope when possible.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.