Skip to content

Document parsing edge cases #11

Open

Description

@kinlane

What a conforming linter does with byte order marks and encodings, partially parsed documents, non-string mapping keys, and $ref cycles.

Open questions in the draft:

  • The document model (draft line 638): A UTF-8 byte order mark is accepted, but OpenLint then reports range columns on every line after the first one too far to the left. A UTF-16 document is not rejected; it parses as garbage and produces parser results. Ignoring a byte order mark and rejecting other encodings would make both deterministic.
  • Parsing (draft line 652): Whether rules run against the part of a document before a syntax error is not stated. OpenLint runs them against whatever tree its parser recovers, which for an unterminated flow collection can be nothing.
  • Parsing (draft line 662): Non-string scalar keys are the one construct OpenLint reports under incompatibleValues. A mapping key that is itself a sequence or a mapping is reported as a warning by the YAML parser, with no option controlling it, and a !!binary or !!set tag ends the run with an error before any result. Whether those constructs belong under incompatibleValues, and whether a tag the linter cannot represent is a parser result, is open.
  • Reference resolution (draft line 686): What a rule sees at the position of a reference in a cycle, and whether resolution follows $ref in every position or only where the document's format expects one, is not stated.

Part of the work to resolve the draft's open questions (discussion #13). AI use: Claude grouped the draft's inline issues and drafted this issue at Kin's request; the questions are quoted from the spec.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions