Page MenuHomePhabricator

Remove empty file options
Closed, ResolvedPublic

Description

Linter can complain about empty file options due to the presence of extraneous pipes.

Tasks:

  • Add code to carry out transformations like this without making any unrelated change to delinter.py: [[File:Example.jpg|thumb||right]] → [[File:Example.jpg|thumb|right]], [[File:Example.jpg|arbitrary||right]] → [[File:Example.jpg|arbitrary|right]] etc.
  • Add tests to test_delinter.py

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
T416767: Fix empty file options in test_delintertoolforge-repos/redminbot!14nagam-surya-narayanaT416767-fixmain
Customize query in GitLab

Event Timeline

Hi, I’d like to work on this task if it’s still available.
I’m new to Wikimedia contributions and recently submitted a Pywikibot patch.

Hi, I’d like to work on this task if it’s still available.
I’m new to Wikimedia contributions and recently submitted a Pywikibot patch.

Hi, yep, you can submit a patch for this if you have an account on Wikimedia GitLab. The repository is located here: https://gitlab.wikimedia.org/toolforge-repos/redminbot/.

Hi @Redmin,
I checked the current upstream main branch and it already contains the fix for empty file options (commit d8466da – Edit test_delinter.py).
It seems this task is already resolved. Could you please confirm and close the task if appropriate?
Thank you.

The code currently only removes file options that only have nowiki tags with no content in between them. The aim of this task is to make it carry out a different transformation so extraneous pipes (|) are removed.

Hi @Redmin,
This patch implements removal of extraneous empty file options in [[File:...]] links, as discussed in T417269. All relevant tests in test_delinter.py pass (45 tests), and only delinter.py and test_delinter.py were modified. The changes are ready for review and merge.
Thanks!

Thanks a lot. :)

Patch has been merged. Thank you for the review and guidance!