objectionary / objectionary/lints

Pinned parser rejects EO examples causing Incorrect examples to not trigger lint

Open
#1,459 0 comments 0 reactions 1 assignee View on GitHub

@yegor256 is already working on this.

Since Sep 16, 2026.

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

Description

What happens

Many EO examples in src/main/resources/org/eolang/motives/**/*.md are not valid EO for the parser that lints depends on (eo-parser 0.63.0, home.version in pom.xml). In 22 motives the Incorrect example doesn't even trigger the lint it documents, because the parser rejects it before the lint gets a chance to run.

I ran every fenced eo and xml block of every motive through EoSyntax(...).parsed() and then through its own LtByXsl (lints de102d68). There are 199 blocks, and 85 of them, in 41 motives, come back with parser errors:

parser error blocks
a blank line must separate the top comment block from the rest of the file 47
comment is allowed only on top of the file, before metas 20
QQ is not a valid object name, root Q must be followed by a dot 6
unexpected content after name suffix 3
test attribute legal only as direct child of top-level object 2
missing blank line before a +> test attribute (R-6.5.3) 2
object inside formation must have a name 1
line shape not yet implemented in spec parser 1

Most of them are the old style of putting a # Comment. right above an object, QQ.io.stdout, and tests written as [] +> name without the blank line.

The Incorrect example yields no defect of its own lint in these motives:

atoms/atom-without-rt, comments/comment-is-too-wide, comments/comment-not-capitalized, comments/comment-starts-with-article, comments/comment-too-short, comments/comment-without-dot, critical/named-object-abstract-nested, design/no-attribute-formation, design/too-deep-object, misc/anemic-getter, misc/incorrect-test-object-name, misc/redundant-object, misc/sparse-seq, misc/sprintf-constant-args, misc/sprintf-without-formatters, misc/wrong-sprintf-arguments, names/anonymous-formation, names/compound-name, names/invalid-name-notation, names/phi-is-not-first, tests/test-word, tests/unit-test-without-phi.

In atoms/rt-without-atoms, metas/incorrect-jvm-rt-location, metas/incorrect-node-rt-location and tests/unit-test-missing, it's the other way round: the Correct example doesn't parse, and its own lint reports a defect on it.

For example, comments/comment-too-short.md:

# This comment is short.
[] > foo
  42 > @

is rejected with [2:0] a blank line must separate the top comment block from the rest of the file, and comment-too-short stays silent on it.

Why it matters

The motive is what a user reads after getting a defect (Lint.motive()). An example that the compiler refuses, or one that the lint doesn't flag, doesn't explain the rule. It also hides real drift. For instance, the three sprintf motives still use QQ.txt.sprintf, which is the base #1371 says the modern parser never emits.

Nothing tests the motives. LtByXslTest and PkMonoTest only check that the file exists and isn't empty.

How to fix

  1. Rewrite the examples in current EO syntax: comments only in the file header followed by a blank line, Q.org.eolang... or plain names instead of QQ, tests as +> attributes with exactly one blank line before them.
  2. Add a test that walks every motive, parses each block under Incorrect: and Correct:, fails on parser errors, and checks that the lint reports at least one defect on the Incorrect blocks and none on the Correct ones. That's the check above. It took about 20 seconds for all 94 motives.

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.