Skip to content

#560: route object names through eo:escape in defect messages#860

Draft
bibonix wants to merge 2 commits intoobjectionary:masterfrom
bibonix:fix-560-escape-object-names
Draft

#560: route object names through eo:escape in defect messages#860
bibonix wants to merge 2 commits intoobjectionary:masterfrom
bibonix:fix-560-escape-object-names

Conversation

@bibonix
Copy link
Copy Markdown
Contributor

@bibonix bibonix commented May 4, 2026

yegor256, this PR fixes #560 - object names in defect messages now go through eo:escape(...).

What changed

Two single-source lints rendered object names directly from @name instead of going through eo:escape(...):

  • src/main/resources/org/eolang/lints/critical/pos-without-line.xsl:28 — printed the bare @name with no quoting at all (Object foo have the "@pos" attribute, ...).
  • src/main/resources/org/eolang/lints/misc/duplicate-names-in-diff-context.xsl:27 — wrapped @name in literal " characters but did not call eo:escape, so spaces were not converted to and embedded " characters were left unescaped.

This PR routes both through eo:escape(@name). For names that are plain lowercase identifiers — every name produced by the EO parser today — the rendered text is byte-identical to before, so the existing single-pack assertions ('Object "hello" has the same name as the objects on the lines 6, 8, 10', 'Object "s" has the same name as the objects on the lines 11', etc.) still hold. For a name with an embedded " the message now renders as Object "foo\x22bar" ... instead of being dropped on the floor.

Tests

Two new YAML packs under src/test/resources/org/eolang/lints/packs/single/... exercise the escape path with XMIR documents that use the entity-encoded form name='foo"bar':

  • pos-without-line/escapes-name-in-defect-message.yaml
  • duplicate-names-in-diff-context/escapes-name-in-defect-message.yaml

Both fail on master (the rendered text contains the bare foo"bar, not the escaped "foo\x22bar") and pass with the XSL change applied. They are picked up by the parameterized LtByXslTest.testsAllLintsByEo, which runs all 359 single-pack assertions; locally that test reports Tests run: 359, Failures: 0, Errors: 0, Skipped: 1 after this change.

CI status

The mvn (×3 OS), deep, and reserved jobs fail on this branch. They are pre-existing failures that have been red on master since 2026-04-25 (commit 820cb36b, the qulice 0.27.1 bump): master's mvn install times out in PkByXslTest.doesNotDuplicateDefectsWhenMultipleDefectsOnTheSameLine after 45s. I reproduced the same failure by running mvn clean install -ntp -PskipITs --errors --batch-mode against master locally with no XSL changes — same timeout, same stack — so the redness is unrelated to this PR. Every fast check on this PR (qulice, xcop, pdd, markdown-lint, yamllint, actionlint, bashate, shellcheck, vale, typos, reuse, ort, copyrights, labeler) is green.

bibonix added 2 commits May 4, 2026 05:09
These two YAML packs exercise the same gap from issue objectionary#560:
`pos-without-line` and `duplicate-names-in-diff-context` print object
names from `@name` straight into their defect messages without going
through `eo:escape(...)`, so a name containing an embedded `"` is
rendered as bare text instead of "foo\\x22bar". The packs assert the
escaped form (single quote of `\\x22`, the eo:escape encoding of an
embedded double-quote) and currently fail on master.
…ages

Previously `pos-without-line` printed the bare `@name` and
`duplicate-names-in-diff-context` wrapped it in literal `"` characters
without converting whitespace or quotes. As of this commit both lints
delegate to `eo:escape(@name)`, which adds the surrounding quotes and
maps spaces to U+2334 (⌴) and embedded `"` to `\\x22`. For names
that are plain identifiers the rendered message is unchanged
("foo" → "foo"), so the existing single-pack assertions still hold.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

all object names should be escaped

1 participant