objectionary / objectionary/lints

`phi-is-not-first` only reports the last misplaced `φ` in the document, ignoring multiple formations per file

Open
#1,359 1 comment 0 reactions 1 assignee View on GitHub

@yegor256 is already working on this.

Since Sep 5, 2026.

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

Description

phi-is-not-first takes the last misplaced φ in the whole document, so when two different formations each have one, only the second is reported.

src/main/resources/org/eolang/lints/names/phi-is-not-first.xsl:13:

<xsl:apply-templates select="(//o[@name='φ'][preceding-sibling::o[not(@base='∅') and not(@base='ξ' and @name='xi🌵')]])[last()]" mode="unordered"/>

//o[...] gathers every misplaced φ in the file; the parentheses make [last()] apply to that whole sequence, not to each formation's own. Whatever the file contains, exactly one defect comes out.

Reporting one per formation is deliberate — packs/single/phi-is-not-first/catches-only-last-phi.yaml pins it, with two misplaced φ inside one formation and count(defect)=1 expected. Every pack in that directory has a single formation, so the behaviour that is pinned is the within-formation one.

Across formations the same expression does something nobody asked for:

# No comments.
[] > foo
  y > bar
  x > @

# No comments.
[] > bar
  y > baz
  x > @

foo's misplaced φ is dropped and only bar's is reported. A file with ten such formations yields one defect, and each fix reveals the next one on the following run.

Scoping last() to the formation rather than to the document keeps the pinned behaviour and restores the rest:

<xsl:for-each select="//o[o[@name='φ'][preceding-sibling::o[not(@base='∅') and not(@base='ξ' and @name='xi🌵')]]]">
  <xsl:apply-templates select="(o[@name='φ'][preceding-sibling::o[not(@base='∅') and not(@base='ξ' and @name='xi🌵')]])[last()]" mode="unordered"/>
</xsl:for-each>

so [last()] picks the last offender within each parent, and every parent gets its own defect.

A pack with two formations, each carrying a misplaced φ, expecting count(defect)=2, would keep the two cases apart — the existing packs cannot tell the difference, since they never have a second formation to lose.

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.