Skip to content

Ruleset validation: unknown and extra values are silently accepted #8

Open

Description

@kinlane

Several constructs are accepted today even though they're probably mistakes. For each, the spec has to say whether a conforming linter rejects it, warns, or accepts it, and whether tightening counts as a breaking change (#12).

Related: openlint/openlint#16 (error messages for edge cases).

Open questions in the draft:

  • The ruleset document (draft line 299): documentationUrl takes only an absolute http, https, or ftp URL with a public host, which is how the url format of OpenLint's validator reads a URL. The schema spells that out as a pattern. It rejects mailto: and urn: URIs, localhost, single-label intranet hosts such as http://wiki/docs, private and loopback addresses, and punycode host names; see /conf/ruleset/documentation-url-intranet. Accepting any absolute URI [[RFC3986]] would let a ruleset link to internal documentation.
  • extends (draft line 328): Elements after the mode are accepted and ignored, so [./base.yaml, all, extra] reads as [./base.yaml, all]. OpenLint accepts them although its own validation schema forbids them for this array. Rejecting them would catch a misplaced bracket.
  • Shorthands (draft line 374): A numeric shorthand such as r: 0 is rejected only by OpenLint's validation schema. Its type definitions and its merge code accept a number and would apply it as the severity. Accepting numbers in shorthands would remove the difference with severity without making any ruleset invalid.
  • then (draft line 546): then: [] is accepted, and the rule then asserts nothing and never reports a result. Rejecting an empty array would catch a rule left unfinished.
  • then (draft line 556): An unknown property inside an invocation, such as functionOption without the s, is ignored. When the function has no required option it runs with its defaults; when it has one, the ruleset is rejected for the missing functionOptions with a message that does not point at the misspelling. Rejecting the unknown property would catch the misspelling in both cases.

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