Skip to content

[MULTIPLE_DEFAULT_TAGS] Investigate rule to determine intent and align implementation #152

@mikeharder

Description

@mikeharder

I believe the current implementation of getAllDefaultTags() is incorrect:

avocado/src/index.ts

Lines 175 to 186 in 8ced072

const node = walkToNode(walker, n => n.type === 'code_block')
if (!node) {
break
}
const heading = nodeHeading(node)
if (!heading) {
continue
}
if (getHeadingLiteral(heading) === 'Basic Information' && node.literal) {
const latestDefinition = safeLoad(node.literal)
if (latestDefinition && latestDefinition.tag) {
tags.push(latestDefinition.tag)

  1. find all code blocks
  2. filter to those under markdown heading "Basic Information"
  3. load code block as YAML, without checking if lang=="yaml"
  4. if parsed YAML contains tag, add to list of default tags

Steps 2 and 3 are bugs. Correct:

  1. find all code blocks
  2. filter to those where lang.trim().toLowerCase() === "yaml"
    • excludes code blocks with non-default conditions like yaml $(tag) == 'foo' or yaml $(foo)
  3. load code block as YAML
  4. if parsed YAML contains tag, add to list of default tags

Impacted PRs

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions