Skip to content

Add misplaced-dataization lint - #1523

Merged
yegor256 merged 2 commits into
masterfrom
1522
Oct 2, 2026
Merged

yegor256 merged 2 commits into
masterfrom
1522

Conversation

@yegor256

@yegor256 yegor256 commented Oct 2, 2026

Copy link
Copy Markdown
Member

This adds design/misplaced-dataization, an experimental warning for a ! or dataized inside a nested formation whose target is a plain chain through ^. That object belongs to the enclosing formation, yet every copy of the nested one dataizes it again. The message names the enclosing formation as the place to move it to.

The heart of it is one selector:

<xsl:for-each select="//o[@base = 'Φ.dataized' and count(o) = 1 and o[empty(o) and (@base = 'ξ.ρ' or starts-with(@base, 'ξ.ρ.'))] and not(ancestor::o[eo:test-name(@name)])]">
  <xsl:variable name="formation" select="ancestor::o[eo:abstract(.)][1]"/>
  <xsl:variable name="outer" select="$formation/ancestor::o[eo:abstract(.)][1]"/>
  <xsl:if test="exists($outer)">

It follows the three conditions from the issue, with one narrowing worth a look: the chain has to start with ξ.ρ, so a bare global like eol! stays silent. Letting globals in added two hits on eo-runtime, and one of them, win32.wsa-cleanup >>! in socket.eo, is a syscall that must run on every call. The parser rolls dispatches on a reference into its name, so a plain chain is always one childless object. Tests are skipped, because their copies don't repeat.

I parsed eo-runtime from current objectionary/eo master with eo-parser 0.63.0 and ran the sheet over every file. It fires on exactly the six places the issue lists: string/joined.eo:22, bytes/array.eo:15, bytes/hash.eo:18, bytes/as-input.eo:60, path.eo:108 and path.eo:199. The rewritten joined from the issue passes clean.

"dataization" joins the LanguageTool ignore list, and both it and "syscall" join the vale vocabulary. Applications with literal arguments, like i64/div.eo:49, stay out of scope, since the issue leaves that call to the architect. Closes #1522.

Add the experimental design/misplaced-dataization warning. It fires on a
Φ.dataized (both `x!` and `dataized x`) when the formation holding it is
nested inside another formation of the same file and the target is a
plain chain of attribute reads through ξ.ρ, with no application. Globals,
literals, applications such as syscalls, top-level formations and tests
are left alone. On eo-runtime it fires on exactly the six places named in
the issue.

Teach LanguageTool and vale the words "dataization" and "syscall".
…1522-512520

# Conflicts:
#	.github/styles/config/vocabularies/Custom/accept.txt
#	src/test/java/matchers/GrammarMatcher.java
Copilot AI balanced review requested due to automatic review settings October 2, 2026 07:29
@yegor256

yegor256 commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

@volodya-lombrozo could you review this one when you have a moment? The lint fires on the six eo-runtime spots from the issue and nowhere else.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds a new experimental design lint to detect repeated dataization (! / dataized) performed inside nested formations when it targets an outer formation’s plain ^-based attribute chain, suggesting the dataization be moved to the nearest enclosing formation.

Changes:

  • Introduces design/misplaced-dataization XSL lint emitting an experimental warning with a “move it up into …” hint.
  • Adds a focused test pack covering positives/negatives and a special “missing @line” XML case.
  • Updates spelling/vocabulary tooling to accept new terminology used by the lint and its motive.
File Description
src/​main/​resources/​org/​eolang/​lints/​design/​misplaced-dataization.xsl Implements the new misplaced-dataization lint logic and emitted defect message.
src/​main/​resources/​org/​eolang/​motives/​design/​misplaced-dataization.md Documents the rationale and examples for the new lint.
src/​test/​java/​matchers/​GrammarMatcher.java Extends LanguageTool ignore tokens to accommodate new terminology.
.github/​styles/​config/​vocabularies/​Custom/​accept.txt Adds Vale vocabulary patterns for “dataize*” and “syscall*”.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​prints-context-when-lines-empty.yaml Tests context emission when parser line info is absent (line=0).
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​names-the-nearest-enclosing-formation.yaml Verifies message points to the nearest enclosing formation by name.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​catches-plain-name-of-an-outer-attribute.yaml Positive case: plain outer attribute dataization should warn.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​catches-parent-dataized-in-a-recursive-formation.yaml Positive case: recursive nested formation repeats outer dataization.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​catches-dataized-keyword-on-an-outer-attribute.yaml Positive case: dataized keyword on outer attribute should warn.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​catches-dataization-in-an-anonymous-formation.yaml Positive case: anonymous formations referenced by line labels.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​allows-dataization-of-its-own-void.yaml Negative case: dataization of own attributes should not warn.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​allows-dataization-of-a-global.yaml Negative case: global dataization should not warn.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​allows-dataization-moved-up-into-the-outer-formation.yaml Negative case: corrected pattern should be clean.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​allows-dataization-in-a-top-level-formation.yaml Negative case: top-level formation should be clean.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​allows-dataization-in-a-test.yaml Negative case: tests should be excluded.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​allows-an-application-with-literal-arguments.yaml Negative case: applications with literals remain out of scope.
src/​test/​resources/​org/​eolang/​lints/​packs/​single/​misplaced-dataization/​allows-a-syscall-on-outer-objects.yaml Negative case: syscalls/applications should be excluded.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +56 to +57
"dataization", "decoratee", "eolang", "spdx", "SPDX-compliant",
"Unlinting", "cyclomatic"
-->
<xsl:template match="/">
<defects>
<xsl:for-each select="//o[@base = 'Φ.dataized' and count(o) = 1 and o[empty(o) and (@base = 'ξ.ρ' or starts-with(@base, 'ξ.ρ.'))] and not(ancestor::o[eo:test-name(@name)])]">
@yegor256
yegor256 merged commit a069809 into master Oct 2, 2026
25 checks passed
@yegor256
yegor256 deleted the 1522 branch October 2, 2026 08:21
@github-actions github-actions Bot added the core Changes are made to core parts of the code base label Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes are made to core parts of the code base

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linter fails to detect unnecessary dataizations in nested formations

2 participants