Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug(#4828): mandatory @as attribute#4829

Merged
yegor256 merged 3 commits into
objectionary:masterfrom
maxonfjvipon:bug/#4828/mandatory-as-attribute
Jan 27, 2026
Merged

bug(#4828): mandatory @as attribute#4829
yegor256 merged 3 commits into
objectionary:masterfrom
maxonfjvipon:bug/#4828/mandatory-as-attribute

Conversation

@maxonfjvipon
Copy link
Copy Markdown
Member

@maxonfjvipon maxonfjvipon commented Jan 26, 2026

Closes: #4828

Summary by CodeRabbit

  • Tests

    • Re-enabled integration and unit test suites that were previously skipped.
  • New Features

    • Enhanced parser transformation pipeline with improved object attribute handling to ensure consistent and correct code generation.
  • Bug Fixes

    • Refined tuple transformation logic to support specific base variants accurately.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

Re-enables previously disabled tests and augments the EO parser's XSLT transformation pipeline by introducing mandatory-as and unnecessary-as stylesheets to handle @as attribute assignment and removal in nested objects, while narrowing tuple-transformation support to the standard Φ prefix variant.

Changes

Cohort / File(s) Summary
Test Re-enablement
eo-integration-tests/src/test/java/integration/ReadmeSnippetsIT.java, eo-maven-plugin/src/test/java/org/eolang/maven/MjLintTest.java
Removed @Disabled annotations and org.junit.jupiter.api.Disabled imports to re-enable previously skipped test methods.
Parser Transformation Pipeline
eo-parser/src/main/java/org/eolang/parser/EoSyntax.java, eo-parser/src/main/java/org/eolang/parser/Xmir.java
Extended XSLT transformation sequences: added mandatory-as.xsl to EoSyntax canonical chain after decorate.xsl, and added unnecessary-as.xsl to Xmir FOR_EO sequence between dataized-to-const.xsl and to-eo.xsl.
XSLT Stylesheets
eo-parser/src/main/resources/org/eolang/parser/parse/mandatory-as.xsl
Renamed stylesheet id from add-as-attributes-inside-application to mandatory-as. Added template to assign @as attributes (α-indexed) to nested o elements where base starts with a dot, handling missing @as attributes through computed indices.
XSLT Stylesheets
eo-parser/src/main/resources/org/eolang/parser/print/tuples-to-stars.xsl
Narrowed template match conditions and inner guards by removing support for the Φ̇ (Phi-dot) variant, restricting transformation to only the standard Φ.org.eolang.tuple prefix.
XSLT Stylesheets
eo-parser/src/main/resources/org/eolang/parser/print/unnecessary-as.xsl
New stylesheet implementing reverse transformation of mandatory-as. Defines eo:all-alphas() function and templates to conditionally remove @as attributes from nested o elements based on structural validation and alpha-sequence verification.
Test Resources
eo-parser/src/test/resources/org/eolang/parser/eo-packs/parse/mandatory-as-attribute.yaml, eo-parser/src/test/resources/org/eolang/parser/eo-packs/print/unnecessary-as.yaml
Updated mandatory-as test assertions and added new unnecessary-as test pack validating zero occurrences of @as attributes after transformation reversal.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

core

Suggested reviewers

  • yegor256

Poem

🐰 Tests awaken from their slumber deep,
With @as attributes in careful keep—
Mandatory then unnecessary springs,
As the parser spreads its XSLT wings!
Φ shines alone, the dot-variants fade,
A transformation gracefully made. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive While most changes align with restoring @as attribute handling, the tuple transformation narrowing (tuples-to-stars.xsl) removing Φ̇ variant support appears potentially unrelated and requires clarification. Clarify whether the tuples-to-stars.xsl changes are intentional and related to the @as attribute restoration, or if they are separate bug fixes that should be in a different PR.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: restoring mandatory @as attribute functionality by re-introducing the required XSLT transformations.
Linked Issues check ✅ Passed The PR successfully addresses issue #4828 by restoring the missing @as attribute functionality through new XSLT transformations (mandatory-as.xsl and unnecessary-as.xsl) in the parsing pipeline.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 26, 2026

🚀 Performance Analysis

All benchmarks are within the acceptable range. No critical degradation detected (threshold is 100%). Please refer to the detailed report for more information.

Click to see the detailed report
Test Base Score PR Score Change % Change Unit Mode
benchmarks.XmirBench.xmirToEO 171.362 209.514 38.152 22.26% ms/op Average Time

⚠️ Performance loss: benchmarks.XmirBench.xmirToEO is slower by 38.152 ms/op (22.26%)

@maxonfjvipon
Copy link
Copy Markdown
Member Author

@yegor256 please check

@yegor256 yegor256 merged commit e12c37a into objectionary:master Jan 27, 2026
27 checks passed
@0crat
Copy link
Copy Markdown

0crat commented Jan 28, 2026

@maxonfjvipon Thanks for the contribution! You've earned +12 points for this: +16 as a basis, +8.4 for your 168 hits-of-code (0.05 × 168, capped at 16), but -4 deducted since you exceeded 100 hits-of-code and -8.4 for review comments beyond the first 4. According to our policy, contributions with fewer hits-of-code typically earn higher rewards, so please keep them smaller but coming frequently! 🎯 Your running score is +236; don't forget to check your Zerocracy account too.

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.

add-as-attributes-inside-application.xsl Missing from EoSyntax

3 participants