#560: route object names through eo:escape in defect messages#860
Draft
bibonix wants to merge 2 commits intoobjectionary:masterfrom
Draft
#560: route object names through eo:escape in defect messages#860bibonix wants to merge 2 commits intoobjectionary:masterfrom
bibonix wants to merge 2 commits intoobjectionary:masterfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
@nameinstead of going througheo:escape(...):src/main/resources/org/eolang/lints/critical/pos-without-line.xsl:28— printed the bare@namewith 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@namein literal"characters but did not calleo: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 asObject "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 formname='foo"bar':pos-without-line/escapes-name-in-defect-message.yamlduplicate-names-in-diff-context/escapes-name-in-defect-message.yamlBoth 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 parameterizedLtByXslTest.testsAllLintsByEo, which runs all 359 single-pack assertions; locally that test reportsTests run: 359, Failures: 0, Errors: 0, Skipped: 1after this change.CI status
The
mvn (×3 OS),deep, andreservedjobs fail on this branch. They are pre-existing failures that have been red onmastersince 2026-04-25 (commit820cb36b, the qulice 0.27.1 bump):master'smvn installtimes out inPkByXslTest.doesNotDuplicateDefectsWhenMultipleDefectsOnTheSameLineafter 45s. I reproduced the same failure by runningmvn clean install -ntp -PskipITs --errors --batch-modeagainstmasterlocally 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.