Incorrect alphabetical ordering of `+alias` metas due to short name sorting by parser

Open Beginner friendly
#1,581 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@opusstudiohq-max is already working on this.

Since Oct 24, 2026.

  • #1593 by @opusstudiohq-max — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, xml

Research direction

Start with src/main/resources/org/eolang/lints/metas/unsorted-metas.xsl lines 14–17 and compare its ordering key with the source spelling of +alias metas; the parser expands alias tails before the lint sees them. Add the two packs described in the issue beside the existing packs under src/test/resources/org/eolang/lints/packs/single/unsorted-metas/, then run LtByXslTest#checksAllLints. Done means the sorted example has no defect and the swapped example warns on line 2.

Written by the indexing model from the issue text.

Description

bug good-title

Bug

src/main/resources/org/eolang/lints/metas/unsorted-metas.xsl (lines 14-17) compares concat(head, ' ', tail) of each meta with the previous one. For +alias the parser has already expanded the tail: +alias org.eolang.txt.sprintf arrives as tail sprintf Φ.org.eolang.txt.sprintf. So the lint orders aliases by their last segment (sprintf, stdout), not by what is written in the source. The motive (motives/metas/unsorted-metas.md) says "Metas must be alphabetically ordered" and its example orders aliases by the name as written.

Steps to reproduce

+alias org.eolang.io.stdout
+alias org.eolang.txt.sprintf

[] > foo
  42 > @

and the same program with the two aliases swapped.

Actual result

The sorted program gets:

<defect line="2" severity="warning">The "alias⌴sprintf⌴Φ.org.eolang.txt.sprintf" meta is out of order</defect>

The swapped program (org.eolang.txt.sprintf before org.eolang.io.stdout), which is really out of order, gets no defects.

Expected result

No defect for the first program, and a warning on line 2 for the second one, as for +alias org.eolang.io.stdout before +alias org.eolang.io.stdin in the motive.

Test

Two packs next to the existing ones in src/test/resources/org/eolang/lints/packs/single/unsorted-metas/ fail on master 46a7315 in LtByXslTest#checksAllLints:

# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
# SPDX-License-Identifier: MIT
---
sheets:
  - /org/eolang/lints/metas/unsorted-metas.xsl
defects: 0
input: |
  +alias org.eolang.io.stdout
  +alias org.eolang.txt.sprintf

  [] > foo
    42 > @
# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
# SPDX-License-Identifier: MIT
---
sheets:
  - /org/eolang/lints/metas/unsorted-metas.xsl
defects:
  - severity: warning
    line: 2
input: |
  +alias org.eolang.txt.sprintf
  +alias org.eolang.io.stdout

  [] > foo
    42 > @
FAIL: /defects[count(defect)=0]
FAIL: /defects[count(defect)=1]
FAIL: /defects/defect[@severity='warning' and @line='2']

This is not #1391 (an out-of-order meta compared with the first meta instead of its neighbour): here neighbours are compared, but by the expanded text.

Dominant language
Java
Stars
14
Forks
40
Avg merge
3d 10h
Merged PRs (30d)
68

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from objectionary/lints

All issues in objectionary/lints

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.