`wrong-sprintf-arguments` causes `Source#defects()` to crash with `ValidationException` when `.printf` has no arguments
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 80/100
Research direction
Start with src/main/resources/org/eolang/lints/misc/wrong-sprintf-arguments.xsl and inspect how the stylesheet handles .printf when there is no o[@as] child. Reproduce with the EO example in the issue and run the Source#defects() call. Done when it returns defects or stays silent without throwing, and other lints still report their defects.
Written by the indexing model from the issue text.
Description
wrong-sprintf-arguments crashes the whole Source#defects() call with a Saxon ValidationException when .printf is used without any argument. The caller gets an exception instead of the defects, so no other lint reports anything for that file.
Steps to reproduce
On master at 245d999f90b0607f1e560f5e2bfa11b321f276c4, parse this program and run the lints:
+package a
# Foo.
[] > foo
"ab".printf > @
new Source(new EoSyntax(eo).parsed()).defects();
Actual result
com.google.common.util.concurrent.UncheckedExecutionException
Caused by: net.sf.saxon.type.ValidationException: Cannot convert string "" to double
Saxon also prints #error(): Cannot convert string "" to double; SystemID: .../wrong-sprintf-arguments. A template with specifiers, such as "ab %d and %s".printf, fails in the same way.
Expected result
The program is valid EO, since printf is just not applied yet, so the lint should either report a normal defect about the missing tuple or stay silent, and the other lints should still return their defects. As a control, the same program with an argument, "ab".printf *, is inspected normally and returns its defects.
Technical evidence
In src/main/resources/org/eolang/lints/misc/wrong-sprintf-arguments.xsl the variable used is built by <xsl:apply-templates select="o[@as][1]" mode="arguments"/>. When .printf has no o[@as] child, nothing is produced and $used is an empty text value. The next step compares it as a number, $used=-1, and Saxon cannot convert an empty string to a double.
The arguments template returns -1 for an argument that is not a tuple, but nothing handles the case when there is no argument at all. #1548 describes a wrong count for another input of the same lint, and #1571 concerns the stylesheets that decode the template, so neither covers this.
- Dominant language
- Java
- Stars
- 14
- Forks
- 39
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 34
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
- 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.
More from objectionary/lints
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/lints#1600 ·
Maintainers usually reply within 2 days
-
`download-model` in `pom.xml` fetches `en-pos-perceptron.bin` from a dead URL, so a build without a warm `~/.m2` cache fails with 404Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/lints#1599 ·
Maintainers usually reply within 2 days
-
README's "Running Locally" example prints `[mandatory-spdx/S WARNING]:1 ...`, but that defect is printed without a source linePossibly taken @gemshrine claimed this today. Openbug
Difficulty 1/5 Under an hour Newbie friendliness 78/100
objectionary/lints#1598 ·
Maintainers usually reply within 2 days
-
The motive of `incorrect-spdx` lists `SPDX-FileCopyrightText Copyright (c) ...` without a colon as valid, but the lint reports itPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
objectionary/lints#1596 ·
Maintainers usually reply within 2 days
-
The motive of `incorrect-jvm-rt-location` lists `+rt jvm the:great:gatsby:1.2.3` as correct, but the lint reports itPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
objectionary/lints#1588 ·
Maintainers usually reply within 2 days
All issues in objectionary/lints
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Dans-Plugins/Medieval-Roleplay-Engine#384 ·
Maintainers usually reply within 1 day
-
bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
:Search Relevance/Vectors >test-failure needs:risk Team:Search Relevance
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
elastic/elasticsearch#163668 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
bug critical
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
agent:working bug follow-up lane:auto
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Sanne/incus-spawn#1765 · 2 comments ·
Maintainers usually reply within 1 day