objectionary / objectionary/lints
PkByXsl.motive() returns the classpath URL string instead of the markdown content for all XSL lints
Nobody has claimed this yet.
- 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:
InputOf(CharSequence)in cactoos treats the argument as content, not as a classpath path — the string itself is returned verbatim.- The derived string still carries the
jar:file:/...!/prefix, so even withResourceOfit 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.checksAllMotivesonly asserts non-empty.LtByXslTest.returnsMotiveuses 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
- 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.
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