Jump to content

Wikipedia talk:Linter

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Dark mode tracking thread

[edit]

I propose to use this thread to track individual questions about, and problems with, the new dark mode Linter tracking. Please report questions, problems, false positives, false negatives, and other issues here.

Possible false negatives in Template:Infobox royalty

[edit]

I'm seeing what looks like a false negative in {{infobox royalty}}. In this version of the sandbox, we have this formatting for |succession=: | headerstyle = background-color: #e4dcf6;line-height:normal;padding:0.2em 0.2em. I see a background-color defined without a corresponding color, which I think should cause a Linter error when the infobox is rendered. In this forced dark mode view of the testcases page, the value of |succession=, "Queen consort of England", shows as black text on a black background, which is an error. The testcases page reports no Linter errors.

I'm also getting a report that "from desktop, the above (name) text in black however, in mobile app it is white and does not match with the background color." On the mobile view, I'm seeing the "above" text (e.g. "King Ahab") as black text on a sort of purple background. On the dark mode mobile view of the testcases page, I'm seeing the "above" text (e.g. "King Ahab") in white on black. What could be causing the person reporting this problem to see something different? – Jonesey95 (talk) 18:00, 4 July 2024 (UTC)[reply]

Hmm odd 🤔. I am seeing this in Special:LintErrors here: https://phabricator.wikimedia.org/F56229922 so am not sure why the testcases page is not reporting an issue? Maybe worth a bug?
https://en.wikipedia.org/wiki/Special:LintErrors/night-mode-unaware-background-color?wpNamespaceRestrictions=0&titlecategorysearch=Alexander+the+Great&exactmatch=1&tag=all&template=all
The headerstyle needs to be updated to have "color:inherit;" to fix this issue.
Regarding apps, I chatted with a developer about that yesterday and it seems apps are doing a few things that need adjusting now web has dark mode. I wouldn't worry about that for now - but do feel free to get a bug on Phabricator tagged with #dark-mode and someone in apps can look into it. 🐸 Jdlrobson (talk) 02:34, 5 July 2024 (UTC)[reply]
Alexander the Great turned out to be an unlucky example. It transcluded about ten templates that all needed to be updated. The article itself, and Infobox royalty, did not need to be changed to remove the dark mode tracking lint from Alexander.
Re the header style above needing to be updated, that is the bug I am reporting. It needs to be updated, it results in invalid dark mode output, but it is not throwing a Linter error. It should. – Jonesey95 (talk) 04:37, 5 July 2024 (UTC)[reply]
DId you report this on Phabricator already? It looks like an issue with mediawiki-extensions-Linter. Jon (WMF) (talk) 18:54, 5 July 2024 (UTC)[reply]
I was being lazy or hoping someone would explain why I was wrong. T369394. – Jonesey95 (talk) 21:06, 5 July 2024 (UTC)[reply]

includeonly / noinclude Fostered Content

[edit]

Unsure if related or not, but the timing is peculiar. Today has brought on a new batch of 300some pages (most transcluded) claiming fostered content errors, due to the inclusion of includeonly and noinclude tags around startings and closings of tables. This behavior is typically not a lint error and is commonly used in the cases of transclusions. Why they are claiming errors I do not know. Anyone know what occurred? This isn't the only time I've seen this issue popup for select pages, but it's always cleared up before I get bothered enough to ask about it. Many of the pages are linked to the noinclude of the {{Ranks and Insignia of Non NATO Air Forces/OR/Blank}} template's opening bracket/parameters, and that page (really most of these pages) haven't been edited in awhile, and were not problematic when the fostered content errors were finished off to a remaining 10 or so pages two weeks ago. Zinnober9 (talk) 19:22, 4 July 2024 (UTC)[reply]

I think there was a bug report in Phabricator for this, but I am unable to find it via a Phab search. Pages like Line 4 (Shanghai Metro) appear to be affected; I remember that page and its siblings being affected by a similar problem a while ago. Since I could not find a bug, I filed a new one. T369317. – Jonesey95 (talk) 20:08, 4 July 2024 (UTC)[reply]
This phabricator bug has been fixed, so listed "fostered content" errors are real now. In articles, check for invalid recent edits (e.g. unsourced, vandalism, gibberish, terrible formatting); reverting them is often the easiest way to fix the Linter error. – Jonesey95 (talk) 00:43, 27 July 2024 (UTC)[reply]
One of the upsides of the previous error was that I've came across quite a few pages that an editor had used multiple noinclude type tags around the same section. Gonnym (talk) 11:07, 28 July 2024 (UTC)[reply]

Possible false negative in Template:DYK tools when used on a DYK page with light green background

[edit]

Please see Template:Did you know nominations/St. Anne's Church, Moxi, which was showing a dark mode error. The page has a div tag that assigns a light green background. I tried added "color:inherit", but that turned the text white or light gray in dark mode. I changed that to "color:black", which displays the page properly in dark mode. The problem is that in both light and dark mode, the {{DYK tools}} box header shows black text; in the dark mode, that black text is on a black background. The page shows no Linter errors, but there is a display error. The DYK tools box header was also showing black-on-black in dark mode before I fixed the surrounding div tag. When I put {{DYK tools}} by itself in my sandbox, it shows the box header in white text on a black background. – Jonesey95 (talk) 20:32, 4 July 2024 (UTC)[reply]

I think this edit has fixed that. -- WOSlinker (talk) 21:33, 4 July 2024 (UTC)[reply]
Could really do with a full list of all those css variables and what the color values they are for both dark and light modes. Anyone know where these are? -- WOSlinker (talk) 21:35, 4 July 2024 (UTC)[reply]
What the heck is color: var(--color-base);? I don't see that anywhere on the Help page for this tracking category. Jdlrobson, do you know anyone who could improve the help page to add this useful tidbit and explain when to use it? So far, I'm limited to trial and error with color:inherit and color:black, which is not very sophisticated. – Jonesey95 (talk) 04:40, 5 July 2024 (UTC)[reply]
I've found a few of those CSS variables and have listed them at User:WOSlinker/CSSvars. -- WOSlinker (talk) 07:32, 5 July 2024 (UTC)[reply]
I updated https://www.mediawiki.org/wiki/Help:Lint_errors/night-mode-unaware-background-color#Quick_start. Hopefully that's the improvement you needed? Jon (WMF) (talk) 19:49, 5 July 2024 (UTC)[reply]

Another milestone, and some more help needed

[edit]

As of earlier today, the list of articles with lint errors, when constrained to >=2 errors per page, was empty! Special thanks to WOSlinker who I've seen help out here a lot the last few days/weeks. I've since removed that >=2 constraint, and we've got a big list of more work to do.

Next, something I'd like some help with: 2024 United States House of Representatives elections in California keeps reappearing at the top of the list, with 2-4 stripped tag errors. The page is so big that lintHint chokes on it, and I can't even edit the article with syntax highlighting enabled. Purging the page will sometimes cause the errors to disappear, but they'll eventually come back. I've made a copy of the page in my sandbox, but that one does not show any stripped tag errors in the page information. Can someone shine some light on this? Feel free to experiment in my sandbox if it helps. --rchard2scout (talk) 12:15, 23 July 2024 (UTC)[reply]

It seems as though becasuse the page is so large, sometimes there are script timeout errors, which can cause then lint errors due to failed scripts. -- WOSlinker (talk) 12:29, 23 July 2024 (UTC)[reply]
Yeah, big pages are really annoying in this regard. I'm curious if there's a logical way to fix it, either with longer timeouts (unlikely solution), or if creating some subpages of say "Districts 1-26" and "Districts 27-52" (or each District individually?), and calling them in would address it.
If the data (like the tables) were all already existing on other pages and currently copied, I'd suggest removing the copies here and calling in those tables from the other pages, but it doesn't appear that these pages are set up like that as I'm not seeing identical tables on the couple of districts I looked at. Zinnober9 (talk) 17:23, 23 July 2024 (UTC)[reply]
Probably a discussion to be had at that talk page, but splitting it (in half, in groups of tens, etc) is probably a good idea. Primefac (talk) 17:53, 23 July 2024 (UTC)[reply]

lintHint and page history

[edit]

Why does the lintHint button only appear in previous versions of a page in the article namespace? Being able to check for lint errors in previous versions is useful for establishing which version introduced errors. The only way to check for errors in earlier versions of a page in other namespaces is the go into edit mode – then the lintHint button appears.

Am I missing something? This is my lintHint setup in my common.js page:

var myLintHints = { };
myLintHints.rooms = "*";
mw.hook( "lintHint.config" ).fire( myLintHints );
mw.loader.load( "https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/lintHint/r.js&action=raw&maxage=86400&ctype=text/javascript" );

Thanks —Bruce1eetalk 07:00, 17 August 2024 (UTC)[reply]

Not sure I'm following. You aren't able to use LintHint on article space in article view? If so, that is strange. I'm able to see the LintHint button and scan pages in every namespace in both past and current versions, both in source edit view, and article view, and we appear to have the same setup on our common.js pages. The only thing I've found to block/hide LintHint is activating preview, which is a little annoying, but is manageable. Zinnober9 (talk) 01:25, 19 August 2024 (UTC)[reply]
I'm sorry, I didn't make myself very clear. I can see lintHint in both current and previous versions of pages in the article namespace. But I can only see lintHint in current versions of pages in the other namespaces (Project, Template, etc), not previous versions. —Bruce1eetalk 06:46, 19 August 2024 (UTC)[reply]
Looking at User:PerfektesChaos/js/lintHint § Configuration by JavaScript, I'd assume you'd also need to specify myLintHints.oldid = true; for the button to show on older revisions. Why it's appearing in old versions of articles despite that not being specified I'm not sure. Aidan9382 (talk) 07:03, 19 August 2024 (UTC)[reply]
@Aidan9382: Thank you, that fixed it. The strange thing is that I tried that last week, but it didn't make a difference. Not sure what I did wrong then. —Bruce1eetalk 07:29, 19 August 2024 (UTC)[reply]

Apparent bug in dark mode Linter detection

[edit]

Jdlrobson, this is a case for the developers who have been waiting patiently for us to report possible Linter dark mode detection bugs. In this version of my sandbox, {{WikiProject France/sandbox}} is used. It outputs a piece of code that is flagged by the Linter as a dark mode issue:

<td class="assess import import-Unknown" style="background:#DCDCDC">[[:Category:Unknown-importance France articles|???]]</td>

(which renders the box to the left of "This article has not yet received a rating"). The td element has color:black assigned by the CSS class assess in Module:WikiProject banner/sandbox/styles.css. If you highlight that table cell with an element inspector in a web browser, you can see that the element has these properties:

 
element {
  background: #DCDCDC;
  border: 0.075em solid #DCDCDC;
}
.mw-parser-output .assess {
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  color: black;
}

Note that both color and background are assigned to the element. I believe that this tag should not register a Linter dark mode flag. Also note that the root module in question, Module:WikiProject banner, has 11 million transclusions, so getting it to be compatible with dark mode seems like it would be important to WMF. Let me know if I should file a Phabricator task. – Jonesey95 (talk) 20:55, 21 August 2024 (UTC)[reply]

A Linter detection fix of this type would presumably also help with pages like Wikipedia:Articles for deletion/Donald A. Yerxa, of which we have many, where some xfd-specific classes are defined along with an explicit background-color. If one of the classes could be changed, site-wide, to have a default background-color and color defined, that would probably fix many pages. WP:AFD currently has 544,940 subpages, and I'm guessing that a significant fraction of those pages have the same setup. – Jonesey95 (talk) 21:44, 22 August 2024 (UTC)[reply]
This can be a potential problem in templates which rely on usage alongside other templates e.g. Colbegin for example OR if the stylesheet/template are modified in isolation from each other (Separation of concerns).
The appropriate fix would be to move the inline styles here to the stylesheet and use a class e.g.
.import-Unknown.assess { background:#DCDCDC; }
in this case.
(Note: The linter doesn't have access to the CSS currently.) 🐸 Jdlrobson (talk) 15:11, 25 August 2024 (UTC)[reply]
So, just checking, if color and background are both in the stylesheet then it will not register as an error. They don't need to be in the same class or anything like that? — Martin (MSGJ · talk) 09:40, 6 September 2024 (UTC)[reply]
[edit]

There are 60 User talk pages with links in links error generated by a nonexistent template in Wikidata weekly summary #643. I have started a discussion at Wikipedia talk:WikiProject Wikidata#Wikidata weekly summary #643. —Anomalocaris (talk) 20:05, 2 September 2024 (UTC)[reply]

Hold -- per Jonesey95's reply at the discussion you've linked. Jonesy95 and I discussed it a bit earlier, and we want them to fix it since they broke it. I fixed a similar link issue on the #641 mailer 2 weeks ago, and I would like it not to become a regular thing. Zinnober9 (talk) 21:54, 2 September 2024 (UTC)[reply]
This issue has been addressed today is seems. Not sure how/who, but the result's clean and logical. Nice. Zinnober9 (talk) 22:36, 7 September 2024 (UTC)[reply]

Problem with lintHint?

[edit]

lintHint is failing with an error seconds after clicking the button, even on very short pages. It started yesterday. Is anyone else experiencing this? —Bruce1eetalk 09:10, 6 September 2024 (UTC)[reply]

Bruce1ee, I am too. It seems to be an error on Parsoid's end. — Qwerfjkltalk 12:53, 6 September 2024 (UTC)[reply]
Thank you, that helps. —Bruce1eetalk 13:21, 6 September 2024 (UTC)[reply]
Working fine for me when used on Wikivoyage. Not here though. Zinnober9 (talk) 15:02, 6 September 2024 (UTC)[reply]
I should clarify that I was working with talk pages, so wasn't looking at other types of pages where these templates are more likely. Any update on this issue getting fixed? Zinnober9 (talk) 15:43, 12 September 2024 (UTC)[reply]
@Bruce1ee Yes, been getting HTTP 500 errors since yesterday as well. Special:ExpandTemplates works OK, though. Gamapamani (talk) 11:04, 7 September 2024 (UTC)[reply]
Thanks. I wonder why it still works in ExpandTemplates. —Bruce1eetalk 12:21, 7 September 2024 (UTC)[reply]
Probably because it's not sending the source wikitext for analysis, but the expanded result.
I've experimented a bit, and this error seems to happen when you have any of the following on the page:
There are probably more, but most wikitext appears to work OK when testing from the preview. Gamapamani (talk) 17:13, 7 September 2024 (UTC)[reply]

lintHint appears to be working again. —Bruce1eetalk 23:13, 12 September 2024 (UTC)[reply]

Yup, Linthint's all good again. Too bad all HTML tags are no longer displaying in green for me when Syntax Highlighter is on. Started yesterday on WikiVoyage, today here. They are in a green in my browser's light mode, but in dark, they are indistinguishable from plaintext. Argh. Zinnober9 (talk) 23:43, 12 September 2024 (UTC)[reply]
Zinnober9, see Wikipedia:Village pump (technical)#Tech News: 2024-37 — Qwerfjkltalk 14:45, 13 September 2024 (UTC)[reply]

Template:User sandbox

[edit]

{{User sandbox}} was recently modified to emit tables, which means that pages with this template on a line that begins with a colon (:), pound (#) or asterisk (*) will generate multiline table in list lint errors. I did a regex search to find the "easy" ones, those where the colon, pound or asterisk immediately precedes the template, with up to one space between. There are many harder ones to find, but the linter will find them over time; the workaround is to insert a newline before {{User sandbox}}. As far as I know, there is no regex search for an unlimited number of characters not including a newline. What I'd really like to search for is the string

asterisk as first character on page, or immediately following a newline
an unlimited number of characters not including newline
{{User sandbox}}

If there is a way to do this search, I'd like to know. —Anomalocaris (talk) 06:43, 9 September 2024 (UTC)[reply]

The actual solution, revert the change. Ask the person requesting the change to seek a bot to help them implement it, when they do, they can add it back. There is absolutely no reason to change something that breaks something else and leave it to other people to fix. Gonnym (talk) 08:08, 9 September 2024 (UTC)[reply]
The template was changed following a request and discussion. The template is transcluded on over 300,000 pages, and the overwhelming majority of them do not have the template on a line beginning with a colon, pound, or asterisk. It's fine to clean up the few that use what should be regarded as careless markup. —Anomalocaris (talk) 09:18, 9 September 2024 (UTC)[reply]
I see no discussions in the last 7 months on that page. I see only requests. Again, anyone implementing a request needs to consider the follow up cleanup. If you aren't going to clean up the mess you made, you shouldn't implement changes. Gonnym (talk) 10:14, 9 September 2024 (UTC)[reply]
I have objected to the navbox portion of the change on the template's talk page, as it is disruptive, among other problems. Any of you could do that as well, if you independently decide to do so. – Jonesey95 (talk) 00:30, 10 September 2024 (UTC)[reply]
Right, there was no discussion. I crossed it out. —Anomalocaris (talk) 09:29, 10 September 2024 (UTC)[reply]

Bot assistance needed

[edit]

@WOSlinker and @Qwerfjkl, can your bots help with clearing some issues from Wikipedia:Linter/Signature submissions? Gonnym (talk) 16:28, 17 September 2024 (UTC)[reply]

Gonnym, any in particular? It would take a while to go through one by one and come up with replacement code for all of them. — Qwerfjkltalk 16:28, 18 September 2024 (UTC)[reply]
I'm not in the camp that it's all lint errors in one go, or nothing at all. That has proven it can't be done. To be honest, any on that page that you can will be of help. If you can get those with the higher error count, even better (I've made the table sortable so it's easier to see). Gonnym (talk) 18:27, 18 September 2024 (UTC)[reply]
I would focus on any patterns that are straightforward, like this misnested tag sequence. They mean a foolproof regular expression. If you try to get fancy, there is always a risk of hitting false positives. Keeping the bot edits focused on the "misnested tag" table for now would be a way to reduce some of the higher-priority errors. – Jonesey95 (talk) 15:57, 19 September 2024 (UTC)[reply]
Jonesey95, Gonnym, for something like signatures, where the same text is used a lot, a simple find-and-replace plaintext (without regex) would probably be easier. If someone could make a list of find & replace (& search query) that would be really helpful, otherwise I'll see if I have time to look at this over the weekend. — Qwerfjkltalk 16:21, 19 September 2024 (UTC)[reply]
The "Very Evil" bogus images and misnested User:Eyesnore would both be foolproof X to Y quickies. I'd suspect the "Wikicurious for Latin Music" mass message could be as well. Could all the various Newsletters be tackled with (verbose) X to Y replacements? Zinnober9 (talk) 17:03, 19 September 2024 (UTC)[reply]
I started a "Replacement" column in the misnested tag table. I will probably have time to populate some of it in the next day or two. – Jonesey95 (talk) 17:04, 19 September 2024 (UTC)[reply]
My bot is not an automated bot and is really just javascript assisted editing, so was fine for me when going through some of the high priority issues that caused display problems. It is not really suitable for the bulk editing that MalnadachBot used to do. -- WOSlinker (talk) 17:49, 19 September 2024 (UTC)[reply]
WOSlinker, could it be adapted for w:de:Benutzer:Schnark/js/bandersnatch (a script for JS mass editing)? — Qwerfjkltalk 17:54, 19 September 2024 (UTC)[reply]
It's just scripts such as User:WOSlinkerBot/linttask21.js which is mainly full of regex replaces. -- WOSlinker (talk) 19:06, 19 September 2024 (UTC)[reply]
Qwerfjkl, I have added a bunch of find/replace combinations to Wikipedia:Linter/Signature submissions#Misnested tag. Fixing them will fix many thousands of Linter errors. Other editors are welcome to add more find/replace combinations to that table and to other tables on that page. – Jonesey95 (talk) 17:47, 21 September 2024 (UTC)[reply]
┌───────────────────────────┘
Jonesey95, I think I should be able to do these tomorrow. — Qwerfjkltalk 19:51, 21 September 2024 (UTC)[reply]
BRFA filed. — Qwerfjkltalk 16:09, 22 September 2024 (UTC)[reply]