User:Lemondoge/Gnomehub

From Wikipedia, the free encyclopedia
Gnomehub
 

This page contains several searchlinks that can be used by WikiGnomes (such as myself) to locate pages that could use some 'gnomeification — whether they have minor typos, failure to comply with MOS, etc. — along with some regex expressions that might help locate or fix errors while you're already in a page. In addition, it also contains other utilities, such as useful edit summaries or links to guidelines.

Typo searches[edit]

Some typos that are relatively common, or that appear surprisingly often.

it's is[edit]

[[insource:"it's is" |insource:"it's is"]]

it's has[edit]

[[insource:"it's has" |insource:"it's has"]]

it's has got[edit]

[[insource:"it's has got" |insource:"it's has got"]]

e.t.c.[edit]

etc. is not an acronym
[[insource:/e\.t\.c/ |insource:/e\.t\.c/]]

innacurate[edit]

Should be "inaccurate"
[[insource:"innacurate" |insource:"innacurate"]]

Formatting mistakes[edit]

Errors with formatting, especially those that fail to comply with the MOS.

Reference before period (see MOS:PF)[edit]

[[insource:/\<\/ref\>\./ |insource:/\<\/ref\>\./]]

"Artificial" hatnote[edit]

"See also", "Main article", or "Further information" hatnotes made without using the proper templates (e.g. ''See also: [[Example]]'' rather than {{See also|Example}}). (NOTE: This search is very expensive.)
[[Artificial hatnotes |Artificial hatnotes]]

Modules that can be simplified[edit]

These searchlinks are for detecting modules with portions that could be simplified. All of these search in the module namespace.
NOTE: The regex here may give false positives; it might match an area that actually cannot be simplified any further.

else if[edit]

else if can usually be simplified to elseif.
[[insource:/else[^A-Za-z0-9_\-\"]+if/ |insource:/else[^A-Za-z0-9_\-\"]+if/]]

if a then else[edit]

Can generally be simplified to if not a then.
[[insource:/then[^A-Za-z0-9_\-\"]+else[^i]/ |insource:/then[^A-Za-z0-9_\-\"]+else[^i]/]]

if a then return true else return false[edit]

This detects overly verbose return statements.
[[insource:/then[^!-~]+return true[^!-~]+else[^!-~]+return false/ |insource:/then[^!-~]+return true[^!-~]+else[^!-~]+return false/]]

if not [variable] then error("str")[edit]

Can use assert(variable, "str") instead.
[[insource:/if not [A-Za-z0-9_]+ then[^A-Za-z0-9_\-\"]+error/ |insource:/if not [A-Za-z0-9_]+ then[^A-Za-z0-9_\-\"]+error/]]

not [a] == [b][edit]

Can generally be simplified to [a] ~= [b]. Note: This searchlink is rather inaccurate, and likely needs improvement.
[[insource:/not( +| *\()[!-\<>-\}]+ *[~=]=/|insource:/not( +| *\()[!-\<>-\}]+ *[~=]=/]]

#[table] > 0[edit]

Is just equivalent to #[table] ~= 0, since length is a natural number.
[[insource:/\#[A-Za-z0-9_\.]+ ?> ?0/ |insource:/\#[A-Za-z0-9_\.]+ ?> ?0/]]

#[table] >= 1[edit]

Same as above.
[[insource:/\#[A-Za-z0-9_\.]+ ?>= ?1/ |insource:/\#[A-Za-z0-9_\.]+ ?>= ?1/]]

#[table] < 1[edit]

Is just equivalent to #[table] == 0, since length is a natural number.
[[insource:/\#[A-Za-z0-9_\.]+ ?\< ?1/ |insource:/\#[A-Za-z0-9_\.]+ ?\< ?1/]]

nested not[edit]

Catches stuff like not (a and not b). Regex is insource:/not[^!-~]*\(([^!-~]*(not[^!-~]+)?[!-~]+[^!-~]+and[^!-~]+not[^!-~]+[!-\<>-\}]+[^!-~]*|[^!-~]*not[^!-~]+?[!-~]+[^!-~]+and[^!-~]+(not[^!-~]+)?[!-\<>-\}]+[^!-~]*)\)/; too big to fit in button
[[Search for nested nots |Search for nested nots]]

lorem and (false|nil) or ipsum[edit]

If a module contains x and (false|nil) or y, it is an error! (false|nil) or y is always y, so x and (false|nil) or y will ALWAYS yield y.
[[and[^!-~]+(false|nil)[^!-~]+or|and[^!-~]+(false|nil)[^!-~]+or]]

nested if[edit]

Detects modules with unnecessarily nested if statements; however, will not give you the location in the search results. Note: HIGHLY inaccurate
[[Search for nested if statements |Search for nested if statements]]

Invalid escape sequence[edit]

Attempts to use backslashes to escape certain characters in strings, especially patterns. Usually, this is because % should have been used instead of a backslash. (See the lua reference for valid escape sequences, except that \[ and \] don't actually work.)
Note: This will successfully avoid matching even numbers of backslashes (it won't match something like \\-). However, as a compromise due to the lack of support for lookbehinds, the regex will also harmlessly consume one character behind the first backslash.
[[insource:/[^\\](\\\\)*\\[^\\0-9abfnrtv\"\']/ |insource:/[^\\](\\\\)*\\[^\\0-9abfnrtv\"\']/]]

tonumber(a (and|or) 'string')[edit]

Overly verbose "tonumber" statements. Slightly inaccurate, but can be refined.
[[insource:/tonumber[^!-~]*\([^!-~]*[!-~]+[^!-~]+(and|or)[^!-~]*[\'\"]/|insource:/tonumber[^!-~]*\([^!-~]*[!-~]+[^!-~]+(and|or)[^!-~]*[\'\"]/]]

[^%d] and similar[edit]

Just use %D.
[[insource:/\[\^%[a-zA-Z]\]/ |insource:/\[\^%[a-zA-Z]\]/]]

%d%d*[edit]

[[\[?\^?%[a-zA-Z]\]?\[?\^?%[a-zA-Z]\]?\* |\[?\^?%[a-zA-Z]\]?\[?\^?%[a-zA-Z]\]?\*]]

Regexes[edit]

A few regular expressions that might be helpful for finding errors via search and replace:

Nested link[edit]

/\[((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?) \[\[/

Edit summaries[edit]

Useful edit summaries to provide justification for gnome actions.

Spelling or grammar correction in a quotation[edit]

Mild (grammar/spelling) correction in quotation; although this error might have been in the original quotation, [[MOS:SIC]] says to silently correct insignificant spelling and typographic errors in quotations.

Wikipedia policy resources[edit]

Some Wikipedia policies that you can cite in your edit summaries

  • MOS:SIC: says to silently correct insignificant spelling and typographic errors in quotations.
  • MOS:OL: things that shouldn't be linked
  • MOS:PF: references should usually go after punctuation instead of before