User:Lemondoge/Gnomehub

From WikiProjectMed
Jump to navigation Jump to search
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

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

it's is

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

it's has

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

it's has got

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

e.t.c.

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

innacurate

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

Formatting mistakes

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

Reference before period (see MOS:PF)

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

"Artificial" hatnote

"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

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

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

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

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")

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]

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

#[table] > 0

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

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

#[table] < 1

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

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

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

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

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')

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

[^%d] and similar

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

%d%d*

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

Regexes

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

Nested link

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

Edit summaries

Useful edit summaries to provide justification for gnome actions.

Spelling or grammar correction in a quotation

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

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