objectionary / objectionary/lints

PkByXsl.motive() returns the classpath URL string instead of the markdown content for all XSL lints

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

Nobody has claimed this yet.

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

Description

Problem

PkByXsl.motive() — the provider that backs motive() of every XSL-based lint — returns a URL string instead of the markdown content of the motive file. As a result, calling motive() on any of the ~89 XSL lints obtained through Source/PkByXsl returns garbage like jar:file:/.../org/eolang/motives/misc/redundant-object.md!/ rather than the actual explanation text.

Root cause

src/main/java/org/eolang/lints/PkByXsl.java:74-78 builds the motive input as:

new InputOf(
    PkByXsl.XSL_PATTERN.matcher(
        PkByXsl.LINTS_PATH.matcher(url).replaceAll("eolang/motives")
    ).replaceAll(".md")
)

Two independent problems:

  1. InputOf(CharSequence) in cactoos treats the argument as content, not as a classpath path — the string itself is returned verbatim.
  2. The derived string still carries the jar:file:/...!/ prefix, so even with ResourceOf it would not resolve.

Minimal example

final XML xmir = new XMLDocument("<object/>");
final Collection<Defect> defects = new Source(xmir).defects();
// take any XSL lint, e.g. defects().iterator().next()
defects.iterator().next().motive();
// returns "jar:file:/.../org/eolang/motives/misc/...md!/..." instead of markdown

Expected behavior

motive() returns the markdown content of org/eolang/motives/<dir>/<name>.md, the same way the LtByXsl(String) constructor does via ResourceOf.

Why tests didn't catch it

  • PkByXslTest.checksAllMotives only asserts non-empty.
  • LtByXslTest.returnsMotive uses the other constructor (ResourceOf), which works correctly.

Related

  • #1277 (Java lints from YAML packs) resolves motives through the same broken path.

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.

Research direction

Start in src/main/java/org/eolang/lints/PkByXsl.java:74-78 and compare its motive loading with the LtByXsl(String) constructor using ResourceOf. Review PkByXslTest.checksAllMotives and add coverage that verifies markdown content rather than only non-empty output. Run the relevant PkByXslTest and LtByXslTest tests; done means XSL lints return their motive text.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.