In the process of slowly converting non-sensical multipolygons (before I knew of the follow/trace function) into simple polygons, sometimes miss to see an MP has just a single member left (see discussion) i.e. the outer ring, to do the reconstruct step in JOSM to convert to an SP. No disaster, the next day one of the QA sites will tell and then go back and do that step belated. Question is, is there a procedure in JOSM to catch these prior to upload the edits?
How about a quick search:
type:relation type=multipolygon members:1
This could be used as a validator rule with
JOSM_search("…") though I would suggest to put it in the informational (others) category.
To put your code to the test, first ran it and found nothing, then converted an SP to an MP with the create function and ran code again… Bingo. For now added it to the toolbar, far right where I’ve got several standard searches stuck.
And now that I know, see lots more creative ways to utilize the much underestimated, by me, search box powers.