objectionary / objectionary/lints

sprintf lints match a base (Φ.txt.sprintf) that the modern parser never emits

Open
#1,371 2 comments 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

The three sprintf lints never fire on XMIR produced by the modern EO parser, because they look for an object with @base='Φ.txt.sprintf', which the parser does not emit.

Root cause

All three selectors hard-code the old base:

  • src/main/resources/org/eolang/lints/misc/sprintf-constant-args.xsl:19//o[@base='Φ.txt.sprintf']
  • src/main/resources/org/eolang/lints/misc/sprintf-without-formatters.xsl:20//o[@base='Φ.txt.sprintf'] (and later base='.printf')
  • src/main/resources/org/eolang/lints/misc/wrong-sprintf-arguments.xsl:36//o[@base='Φ.txt.sprintf']

On eo-parser 0.63.0 the actual bases observed in real XMIR are:

  • Φ.sprintf (plain usage),
  • Φ.org.eolang.txt.sprintf (with +alias org.eolang.txt.sprintf sprintf),
  • Φ.sprintf with +package org.eolang.txt.

Φ.txt.sprintf does not appear in any realistic program, so the lints only work against hand-written fixtures.

Minimal example

+package org.eolang.txt
+alias org.eolang.txt.sprintf sprintf

[] > main
  sprintf "Hello %s" "world" > msg

The parsed msg object gets @base='Φ.org.eolang.txt.sprintf' (or Φ.sprintf), so none of the three lints reports anything even when the format string is missing placeholders.

Expected behavior

The lints should match the actual bases produced by the parser (Φ.sprintf, Φ.org.eolang.txt.sprintf, or a Φ.*.sprintf-style predicate), and be covered by packs that use real EO input: rather than synthetic XMIR.

Related

  • #1355 (wrong-sprintf-arguments ineffective due to outdated Φ.txt.sprintf reference)
  • #1357 (sprintf-without-formatters ineffective due to removed Φ.txt.sprintf)
  • #787 (sprintf misbehaves with constant strings)

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

Read the selectors in src/main/resources/org/eolang/lints/misc/sprintf-constant-args.xsl, sprintf-without-formatters.xsl, and wrong-sprintf-arguments.xsl, then inspect the real XMIR produced by the cited EO example. Run the relevant lint packs with real EO input rather than synthetic XMIR. Done means all three lints recognize the parser-emitted sprintf bases and report their intended cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.