objectionary / objectionary/lints
`phi-is-not-first` only reports the last misplaced `φ` in the document, ignoring multiple formations per file
@yegor256 is already working on this.
Since Sep 5, 2026.
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.