Skip to content

LtTestNotVerb.motive() references a non-existent motive file #1268

Description

@VasilevNStas

Problem

LtTestNotVerb.motive() throws an exception because it references a motive file that does not exist.

Details

src/main/java/org/eolang/lints/LtTestNotVerb.java:59:

@Override
public String motive() throws IOException {
    return new MotiveFrom("misc", "test-object-is-not-verb-in-singular").asString();
}

The resource org/eolang/motives/misc/test-object-is-not-verb-in-singular.md does not exist in src/main/resources/org/eolang/motives/misc/ — the only file there is incorrect-test-object-name.md. Since MotiveFrom.asString() reads the resource via TextOf, the missing file makes motive() fail with:

The resource "org/eolang/motives/misc/test-object-is-not-verb-in-singular.md" was not found ...

(I reproduced this locally by calling new LtTestNotVerb().motive().)

Impact

  • The lint's own name() returns unit-test-is-not-verb (line 45), so the motive reference is doubly wrong: it uses a different name than the lint, and that name has no file.
  • motive() is part of the public Lint contract and is delegated by wrappers (LtUnlint.motive(), LtDfSticky.motive()), so any tool that shows lint motives (e.g. IDE integrations, the motives workflow, or a future "explain this lint" feature) will crash on this lint.
  • There is no unit test covering LtTestNotVerb.motive(), which is why this went unnoticed.

Expected behaviour

LtTestNotVerb.motive() should return the content of a real motive file. Either:

  • create src/main/resources/org/eolang/motives/misc/unit-test-is-not-verb.md (matching name()), or
  • point motive() at the correct existing file.

A test asserting motive() succeeds (like LtAsciiOnlyTest.explainsMotive) should be added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions