You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
URLs in code comment should always be unobfuscated.
Various reasons:
Ensure longer time survival (as link shorteners haven't been the most stable services in our time).
Improve availability of the URL (e.g. the uptime of w.wiki isn't as important as that of wikipedia.org, not knowing what something is meant to point at during critical times can waste valuable time).
Allow recognition and graceful degredation. For example, if your URL points to Wikitech, the reader may know that there is a mirror at wikitech-stastic for use during outages. Or if it points to a page you know you've visited before it will either help you find it again because you realise thats the page you're looking for, or you'll know to skip it if you know it doesn't contain what you're looking for.
Allow predicting of its purpose, thus helping you decide whether it is going to be useful in answering your question.
Communicates value by itself, useful even when offline or if the URL stops working.
Consider the following examples and how they set different expectations.
#! extensions/FooBar/src/quux.js
// This is based on CP agency – <https://www.mediawiki.org/wiki/Manual:CP_Agency>letexec=this.estimate(args[i-2]/4.2);
CP Agency might be a mediawiki feature? I can (also) look for that my mediawiki checkout and its docs pages.
// This is based on CP agency – <https://www.mediawiki.org/wiki/Extension:CP_Agency>
.. or some extension? Perhaps I have a copy of it.
// This is based on CP agency – <https://en.wikipedia.org/wiki/Chronology_Protection_Agent_(computer_science)>
Ah, that's what CP stands for, and it's a general principle in programming? I might remember what it means based on that, or might speculate the Wikipedia article won't help me if my question is about an internal thing to MW.
// This is based on CP agency – <https://w.wiki/123>letexec=this.estimate(args[i-2]/4.2);
Who knows?
Proposal
We could start with a short list of common/known url shorteners and pattern check against them with a rule that applies to Comment nodes in the source code model exposed by ESLint.
My main motivation for this rule is documentation blocks (those with /** syntax) since the generated output of that will be versioned and archived for years, accesible through permalinks (example). However, it seems useful for inline comments as well for the same reasons. It's just that inline comments are less widely exposed and can be fixed more easily if needed.
The text was updated successfully, but these errors were encountered:
URLs in code comment should always be unobfuscated.
Various reasons:
Consider the following examples and how they set different expectations.
CP Agency might be a mediawiki feature? I can (also) look for that my mediawiki checkout and its docs pages.
// This is based on CP agency – <https://www.mediawiki.org/wiki/Extension:CP_Agency>
.. or some extension? Perhaps I have a copy of it.
// This is based on CP agency – <https://en.wikipedia.org/wiki/Chronology_Protection_Agent_(computer_science)>
Ah, that's what CP stands for, and it's a general principle in programming? I might remember what it means based on that, or might speculate the Wikipedia article won't help me if my question is about an internal thing to MW.
Who knows?
Proposal
We could start with a short list of common/known url shorteners and pattern check against them with a rule that applies to Comment nodes in the source code model exposed by ESLint.
My main motivation for this rule is documentation blocks (those with
/**
syntax) since the generated output of that will be versioned and archived for years, accesible through permalinks (example). However, it seems useful for inline comments as well for the same reasons. It's just that inline comments are less widely exposed and can be fixed more easily if needed.The text was updated successfully, but these errors were encountered: