Page MenuHomePhabricator

Linter false positive: image caption ending in "px" is incorrectly detected as a Linter error
Open, Needs TriagePublicBUG REPORT

Description

Steps to Reproduce: See https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox&oldid=1010663816 which generates a Linter bogus image options error.

Actual Results:
Linter reports a bogus image options error when a specified px value is present and the caption ends in "px".

Expected Results:
Linter should not report an error.

This is yet another side effect of the failure of the Image parser to include an option to specify "caption=" to force a particular option to be the caption for an image.

This false positive can be worked around by adding an nbsp or any other text after the end of the caption.

This Linter false positive is new. It is probably related to the recent improvement deployed as a fix for T215999.

Event Timeline

This item could have been titled:
Linter false positive: "Foo px" as caption is incorrectly detected as a Linter error
It happens whether or not digits precede px.

Jonesey95 renamed this task from Linter false positive: "Foo 100px" as caption is incorrectly detected as a Linter error to Linter false positive: image caption ending in "px" is incorrectly detected as a Linter error.Mar 10 2021, 1:34 AM
Arlolra added a subscriber: Arlolra.

Yeah, this is fallout from T215999

The alias for width is,

{
  "name": "img_width",
  "aliases": [
    "$1px"
  ],
  "case-sensitive": ""
},

If it fails further validation, it's marked as bogus. The legacy parser, however, will take any failing option and consider it the caption.

A note from someone who regularly fixes lint errors: I've found this linter behaviour useful to detect people using the letter O instead of the digit zero, as in "2OOpx". On nlwiki there have been no other true positives (with suffix "px"). I suggest to adapt this to only consider typos like ppx and characters that resemble digits as bogus. Such as Latin O or o, but perhaps also Cyrillic З and others.