Start checking codebase with the codespell tool
authorJeremy Stanley <fungi@yuggoth.org>
Wed, 16 Sep 2020 22:24:02 +0000 (22:24 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Wed, 16 Sep 2020 22:29:09 +0000 (22:29 +0000)
Use master branch tip of codespell for now, until it supports
configuration in the included .codespellrc in a released version.
Also correct things its default dictionary selection identified as
misspellings, with the exception of intentional misspellings in the
sample spelling correction config and selftest which exercises it.

.codespellrc [new file with mode: 0644]
doc/source/coder.rst
mudpy/misc.py
mudpy/telnet.py
share/command.yaml
tox.ini

diff --git a/.codespellrc b/.codespellrc
new file mode 100644 (file)
index 0000000..5efcde7
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (c) 2020 mudpy authors. Permission to use, copy,
+# modify, and distribute this software is granted under terms
+# provided in the LICENSE file distributed with this software.
+
+[codespell]
+ignore-words-list = files',wont,teh,theyre,youre
+skip = *.pyc,.eggs,.git,.tox,build
index 0e5bcae..b3ed6da 100644 (file)
@@ -125,7 +125,7 @@ cloned it::
 
 Now you should be able to invoke any tox testenv you like. Just
 running :command:`tox` without any additional options will go
 
 Now you should be able to invoke any tox testenv you like. Just
 running :command:`tox` without any additional options will go
-through the defalt battery of checks and is a good way to make sure
+through the default battery of checks and is a good way to make sure
 everything is installed and working. Once you're ready to try out
 the server interactively, launch it like this::
 
 everything is installed and working. Once you're ready to try out
 the server interactively, launch it like this::
 
index 074f538..ba29a90 100644 (file)
@@ -1084,7 +1084,7 @@ def get_loglines(level, start, stop):
     # don't proceed if there are no lines
     if filtered_count:
 
     # don't proceed if there are no lines
     if filtered_count:
 
-        # can't start before the begining or at the end
+        # can't start before the beginning or at the end
         if start > filtered_count:
             start = filtered_count
         if start < 1:
         if start > filtered_count:
             start = filtered_count
         if start < 1:
@@ -1137,7 +1137,7 @@ def wrap_ansi_text(text, width):
     # characters, printable or otherwise
     abs_pos = 0
 
     # characters, printable or otherwise
     abs_pos = 0
 
-    # the current text position relative to the begining of the line,
+    # the current text position relative to the beginning of the line,
     # ignoring color escape sequences
     rel_pos = 0
 
     # ignoring color escape sequences
     rel_pos = 0
 
@@ -1152,7 +1152,7 @@ def wrap_ansi_text(text, width):
     # normalize any potentially composited unicode before we count it
     text = unicodedata.normalize("NFKC", text)
 
     # normalize any potentially composited unicode before we count it
     text = unicodedata.normalize("NFKC", text)
 
-    # iterate over each character from the begining of the text
+    # iterate over each character from the beginning of the text
     for each_character in text:
 
         # the current character is the escape character
     for each_character in text:
 
         # the current character is the escape character
@@ -1194,7 +1194,7 @@ def wrap_ansi_text(text, width):
             # characters but the space it replaced was only one
             abs_pos += 1
 
             # characters but the space it replaced was only one
             abs_pos += 1
 
-            # now we're at the begining of a new line, plus the
+            # now we're at the beginning of a new line, plus the
             # number of characters wrapped from the previous line
             rel_pos -= last_rel_whitespace
             last_rel_whitespace = 0
             # number of characters wrapped from the previous line
             rel_pos -= last_rel_whitespace
             last_rel_whitespace = 0
index 73331b9..ec18f70 100644 (file)
@@ -188,7 +188,7 @@ def negotiate_telnet_options(user):
     # make a local copy to play with
     text = user.partial_input
 
     # make a local copy to play with
     text = user.partial_input
 
-    # start at the begining of the input
+    # start at the beginning of the input
     position = 0
 
     # as long as we haven't checked it all
     position = 0
 
     # as long as we haven't checked it all
@@ -283,7 +283,7 @@ def negotiate_telnet_options(user):
             log("Ignored unknown command %s from" % command, user)
             text = text[:position] + text[position + 2:]
 
             log("Ignored unknown command %s from" % command, user)
             text = text[:position] + text[position + 2:]
 
-        # and this means we got the begining of an IAC
+        # and this means we got the beginning of an IAC
         else:
             position += 1
 
         else:
             position += 1
 
index 10a0cdf..0f4df40 100644 (file)
@@ -1,5 +1,5 @@
 ---
 ---
-_copy: Copyright (c) 2004-2019 mudpy authors. Permission to use, copy,
+_copy: Copyright (c) 2004-2020 mudpy authors. Permission to use, copy,
     modify, and distribute this software is granted under terms
     provided in the LICENSE file distributed with this software.
 
     modify, and distribute this software is granted under terms
     provided in the LICENSE file distributed with this software.
 
@@ -36,7 +36,7 @@ command.halt.help: This will save all active accounts, disconnect all clients
     and stop the entire program.
 
 command.help.description: List commands or get help on one.
     and stop the entire program.
 
 command.help.description: List commands or get help on one.
-command.help.help: This will list all comand words available to you along with
+command.help.help: This will list all command words available to you along with
     a brief description or, alternatively, give you detailed information on one
     command.
 
     a brief description or, alternatively, give you detailed information on one
     command.
 
diff --git a/tox.ini b/tox.ini
index d57c0d7..1ede200 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
 
 [tox]
 minversion = 3.1
 
 [tox]
 minversion = 3.1
-envlist = bandit, dist, docs, flake8, yamllint, selftest_config, py3
+envlist = bandit, codespell, dist, docs, flake8, yamllint, selftest_config, py3
 skipsdist = True
 ignore_basepython_conflict = True
 
 skipsdist = True
 ignore_basepython_conflict = True
 
@@ -26,6 +26,16 @@ deps = bandit
 commands = bandit -r mudpy -x mudpy/tests {posargs}
 usedevelop = False
 
 commands = bandit -r mudpy -x mudpy/tests {posargs}
 usedevelop = False
 
+[testenv:codespell]
+# TODO(fungi) switch to a proper PyPI dep once .codespellrc is supported in a
+# release version, and ratchet down deprecation warnings for it at that point
+#setenv =
+#    PYTHONWARNINGS=error
+#deps = codespell
+deps = git+https://github.com/codespell-project/codespell
+commands = codespell {posargs}
+usedevelop = False
+
 [testenv:demo]
 commands = mudpy {posargs}
 
 [testenv:demo]
 commands = mudpy {posargs}