objectionary / objectionary/lints

`too-deep-object` lint tool reports multiple defects for single nesting chain and emits incorrect depth number

Open
#1,385 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Problem

too-deep-object reports several defects along a single nesting chain (a cascade) and prints a depth number that does not match the rule's threshold, confusing the user.

Root cause

src/main/resources/org/eolang/lints/design/too-deep-object.xsl:13 (selector) and :28 (message):

  • The selector excludes certain wrapper objects (Φ.tuple, Φ.bytes, Φ.number, Φ.string) from the depth count, while the message prints the raw count(ancestor::o) — so the number in the text (e.g. "17 levels") differs from the filtered depth that triggered the rule.
  • Because of the counting difference, more than one node per chain can match the not(o[count(ancestor::o[...]) > 12]) guard, producing a cascade of defects for one chain (observed: defects at depths 13/14/15/17 for a 15-level chain).
  • For data objects the message prints eo:escape(@base) which yields an empty/ name.

Minimal example

+package x
+architect yegor@256.com
+version 0.0.1
+home https://github.com/objectionary
+spdx SPDX-FileCopyrightText: Copyright (c) 2026 Objectionary.com
+spdx SPDX-License-Identifier: MIT

[] > main
  [] > a
    [] > b
      [] > c
        [] > d
          [] > e
            [] > f
              [] > g
                [] > h
                  [] > i
                    [] > j
                      [] > k
                        [] > l
                          [] > m
                            1 > @

Expected behavior

  • The depth number in the message must use the same (filtered) metric as the selector.
  • Only the deepest offending node of a branch should be reported.
  • Use @name (or a clear label) instead of @base for formations.

Related

  • #155 (the lint itself, merged); the cascade/off-by-N behavior is a new regression on top of it.
  • design/ category siblings (broad-scope, excessive-visibility).

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.

Research direction

Start with src/main/resources/org/eolang/lints/design/too-deep-object.xsl, especially the selector at line 13 and message at line 28. Align the reported depth with the filtered metric, report only the deepest offending node in a branch, and use @name or another clear label for formations; verify the minimal example no longer produces cascaded defects.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.