objectionary / objectionary/lints

prohibit inner inner objects with `@base` attributes if it can be merged with its parent

Open
#293 11 comments 1 reaction 1 assignee View on GitHub

@h1alexbel is already working on this.

Since Apr 2, 2025.

bug
Dominant language
Java
Stars
14
Forks
39
Avg merge
22h 54m
Merged PRs (30d)
90

Description

In EO 0.51.0 we introduced roll-bases.xsl that reduced amount of nested objects and merges their @base attributes if it's possible.
Let's make a lint that checks if all possible bases are merged.

Imagine we have two objects:

<o base="X">
  <o base="Y"/>
</o>

If they are merged we get <o base="YX"/>.

We can't merge them if:

  1. X does not start with . (dot)
  2. X starts with . and Y starts with .
  3. Y has inner object Z that can't be merged with Y (apply all the rules for Y-Z pair)
<o base="X">
  <o base="Y">
    <o base="Z"/>
  </o>
</o>
  1. Y has more than 1 any inner objects
  2. Y has data (not empty text())
  3. Y is an abstract object

For more details see the roll-bases.xsl itself

Here X and Y are just variables in common sense, not a specific bases. It can be .seq, $.seq or Q.org.eolang.seq or something similar under the X and Y.

The severity level is warning (temporary)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.