Skip to content

Commit 3ca77a8

Browse files
committed
Add typo checker to prek/pre-commit config
Fix typos
1 parent 50161c4 commit 3ca77a8

File tree

13 files changed

+36
-20
lines changed

13 files changed

+36
-20
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,12 +644,12 @@ The one plugin we consider essential for PyCharm is
644644
[RyeCharm](https://plugins.jetbrains.com/plugin/25230-ryecharm). `RyeCharm` is an all-in-one PyCharm
645645
plugin for [Astral](https://astral.sh/)-backed Python tools: [uv](https://github.com/astral-sh/uv),
646646
[Ruff](https://github.com/astral-sh/ruff), and [ty](https://github.com/astral-sh/ty). NOTE: `ty`
647-
support is provisional as that new type checker is in early alpha developement.
647+
support is provisional as that new type checker is in early alpha development.
648648

649649
#### VSCode Settings
650650

651651
While **VSCode** is a phenomenal IDE for developing in Python, the out-of-the-box experience leaves
652-
a lot to be desired. You will need to install a number of extenstions and tweak the default
652+
a lot to be desired. You will need to install a number of extensions and tweak the default
653653
configuration for many of them in order to get an optimal developer experience.
654654

655655
Recommended VSCode extensions:

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ repos:
33
rev: "v6.0.0"
44
hooks:
55
- id: check-case-conflict
6+
- id: check-executables-have-shebangs
67
- id: check-merge-conflict
8+
- id: check-symlinks
79
- id: check-toml
10+
- id: check-yaml
11+
- id: detect-private-key
812
- id: end-of-file-fixer
13+
- id: fix-byte-order-marker
14+
- id: mixed-line-ending
915
- id: trailing-whitespace
1016

1117
- repo: https://github.com/astral-sh/ruff-pre-commit
@@ -23,3 +29,13 @@ repos:
2329
additional_dependencies:
2430
- prettier@3.8.1
2531
- prettier-plugin-toml@2.0.6
32+
33+
- repo: https://github.com/crate-ci/typos
34+
rev: v1.44.0
35+
hooks:
36+
- id: typos
37+
exclude: |
38+
(?x)^(
39+
ruff.toml|
40+
tests/.*
41+
)$

README.md

100755100644
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ examples.
107107
- [cmd2 example applications](https://github.com/python-cmd2/cmd2/tree/main/examples)
108108
- Basic cmd2 examples to demonstrate how to use various features
109109
- [Advanced Examples](https://github.com/jayrod/cmd2-example-apps)
110-
- More complex examples that demonstrate more featuers about how to put together a complete
110+
- More complex examples that demonstrate more features about how to put together a complete
111111
application
112112
- [Cookiecutter](https://github.com/cookiecutter/cookiecutter) Templates from community
113113
- Basic cookiecutter template for cmd2 application :
@@ -168,7 +168,7 @@ reproduce the bug. At a minimum, please state the following:
168168
| [REW Sploit](https://github.com/REW-sploit/REW-sploit) | Emulate and Dissect Metasploit Framework (MSF) and other attacks | [REW-sploit](https://github.com/REW-sploit) |
169169
| [tomcatmanager](https://github.com/tomcatmanager/tomcatmanager) | A command line tool and python library for managing a tomcat server | [tomcatmanager](https://github.com/tomcatmanager) |
170170
| [Falcon Toolkit](https://github.com/CrowdStrike/Falcon-Toolkit) | Unleash the power of the CrowdStrike Falcon Platform at the CLI | [CrowdStrike](https://github.com/CrowdStrike) |
171-
| [EXPLIoT](https://gitlab.com/expliot_framework/expliot) | Internet of Things Security Testing and Exploitation framework | [expliot_framework](https://gitlab.com/expliot_framework/) |
171+
| [EXPLIoT](https://gitlab.com/expliot_framework/expliot) | Internet of Things Security Testing and Exploitation framework | [exploit_framework](https://gitlab.com/expliot_framework/) |
172172
| [Pobshell](https://github.com/pdalloz/pobshell) | A Bash‑like shell for live Python objects: `cd`, `ls`, `cat`, `find` and _CLI piping_ for object code, str values & more | [Peter Dalloz](https://www.linkedin.com/in/pdalloz) |
173173

174174
Possibly defunct but still good examples
@@ -178,7 +178,7 @@ Possibly defunct but still good examples
178178
| [Katana](https://github.com/JohnHammond/katana) | Automatic CTF Challenge Solver | [John Hammond](https://github.com/JohnHammond) |
179179
| [SatanSword](https://github.com/Lucifer1993/SatanSword) (in Chinese) | Comprehensive Penetration Framework for Red Teaming | [Lucifer1993](https://github.com/Lucifer1993) |
180180
| [Jok3r](http://www.jok3r-framework.com) | Network & Web Pentest Automation Framework | [Koutto](https://github.com/koutto) |
181-
| [Counterfit](https://github.com/Azure/counterfit) | a CLI that provides a generic automation layer for assessing the security of ML models | [Microsoft Azure](https://github.com/Azure) |
181+
| [Counterfeit](https://github.com/Azure/counterfit) | a CLI that provides a generic automation layer for assessing the security of ML models | [Microsoft Azure](https://github.com/Azure) |
182182
| [Overlord](https://github.com/qsecure-labs/overlord) | Red Teaming Infrastructure Automation | [QSecure Labs](https://github.com/qsecure-labs) |
183183
| [Automated Reconnaissance Pipeline](https://github.com/epi052/recon-pipeline) | An automated target reconnaissance pipeline | [epi052](https://github.com/epi052) |
184184
| [JSShell](https://github.com/Den1al/JSShell) | An interactive multi-user web JavaScript (JS) shell | [Den1al](https://github.com/Den1al) |

cmd2/argparse_custom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,14 @@ def __init__(
397397

398398
@property
399399
def choices_provider(self) -> ChoicesProviderUnbound[CmdOrSet]:
400-
"""Retreive the internal choices_provider function."""
400+
"""Retrieve the internal choices_provider function."""
401401
if self.is_completer:
402402
raise AttributeError("This instance is configured as a completer, not a choices_provider")
403403
return cast(ChoicesProviderUnbound[CmdOrSet], self.to_call)
404404

405405
@property
406406
def completer(self) -> CompleterUnbound[CmdOrSet]:
407-
"""Retreive the internal completer function."""
407+
"""Retrieve the internal completer function."""
408408
if not self.is_completer:
409409
raise AttributeError("This instance is configured as a choices_provider, not a completer")
410410
return cast(CompleterUnbound[CmdOrSet], self.to_call)

cmd2/cmd2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def remove(self, command_method: CommandFunc) -> None:
292292

293293
@dataclass(kw_only=True)
294294
class AsyncAlert:
295-
"""Contents of an asynchonous alert which display while user is at prompt.
295+
"""Contents of an asynchronous alert which display while user is at prompt.
296296
297297
:param msg: an optional message to be printed above the prompt.
298298
:param prompt: an optional string to dynamically replace the current prompt.
@@ -608,7 +608,7 @@ def __init__(
608608
# Command parsers for this Cmd instance.
609609
self._command_parsers: _CommandParsers = _CommandParsers(self)
610610

611-
# Members related to printing asychronous alerts
611+
# Members related to printing asynchronous alerts
612612
self._alert_queue: deque[AsyncAlert] = deque()
613613
self._alert_condition = threading.Condition()
614614
self._alert_allowed = False
@@ -3508,7 +3508,7 @@ def _pre_prompt() -> None:
35083508
self._alert_allowed = False
35093509

35103510
def _cmdloop(self) -> None:
3511-
"""Repeatedly issue a prompt, accept input, parse it, and dispatch to apporpriate commands.
3511+
"""Repeatedly issue a prompt, accept input, parse it, and dispatch to appropriate commands.
35123512
35133513
Parse an initial prefix off the received input and dispatch to action methods, passing them
35143514
the remainder of the line as argument.

docs/doc_conventions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ or [The Markdown Guide](https://www.markdownguide.org/) for a more complete refe
4949

5050
Code blocks can be created in two ways:
5151

52-
- Indent the block - this will show as a monospace code block, but won't include highighting
52+
- Indent the block - this will show as a monospace code block, but won't include highlighting
5353
- use the triple backticks followed by the code language, e.g. `python` and close with triple
5454
backticks
5555

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ each:
4242
- Demonstrates usage of `@with_default_category` decorator to group and categorize commands and
4343
`CommandSet` use
4444
- [dynamic_commands.py](https://github.com/python-cmd2/cmd2/blob/main/examples/dynamic_commands.py)
45-
- Shows how `do_*` commands can be dynamically created programatically at runtime
45+
- Shows how `do_*` commands can be dynamically created programmatically at runtime
4646
- [environment.py](https://github.com/python-cmd2/cmd2/blob/main/examples/environment.py)
4747
- Shows how to create custom `cmd2.Settable` parameters which serve as internal environment
4848
variables

examples/command_sets.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
most commands trivial because the intent is to focus on the CommandSet feature set.
77
88
The `AutoLoadCommandSet` is a basic command set which is loaded automatically at application startup and stays loaded until
9-
application exit. Ths is the simplest case of simply modularizing command definitions to different classes and/or files.
9+
application exit. This is the simplest case of simply modularizing command definitions to different classes and/or files.
1010
1111
The `LoadableFruits` and `LoadableVegetables` CommandSets are dynamically loadable and un-loadable at runtime using the `load`
1212
and `unload` commands. This demonstrates the ability to load and unload CommandSets based on application state. Each of these
@@ -102,7 +102,7 @@ def __init__(self) -> None:
102102

103103
self.register_command_set(AutoLoadCommandSet())
104104

105-
# Store the dyanmic CommandSet classes for ease of loading and unloading
105+
# Store the dynamic CommandSet classes for ease of loading and unloading
106106
self._fruits = LoadableFruits()
107107
self._vegetables = LoadableVegetables()
108108

@@ -147,7 +147,7 @@ def do_unload(self, ns: argparse.Namespace) -> None:
147147
@with_argparser(cut_parser)
148148
@with_category(COMMANDSET_SUBCOMMAND)
149149
def do_cut(self, ns: argparse.Namespace) -> None:
150-
"""Intended to be used with dyanmically loaded subcommands specifically."""
150+
"""Intended to be used with dynamically loaded subcommands specifically."""
151151
handler = ns.cmd2_handler.get()
152152
if handler is not None:
153153
handler(ns)

examples/custom_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def integer(value_str: str) -> int:
5151

5252

5353
def hexadecimal(value_str: str) -> int:
54-
"""Parse hexidecimal integer, with optional '0x' prefix."""
54+
"""Parse hexadecimal integer, with optional '0x' prefix."""
5555
return int(value_str, base=16)
5656

5757

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ mccabe.max-complexity = 49
154154
# Ignore starting a process with a partial executable path (i.e. git)
155155
"scripts/validate_tag.py" = ["S607"]
156156

157-
# Ingore various rulesets in test directories
157+
# Ignore various rulesets in test directories
158158
"{tests}/*.py" = [
159159
"ANN", # Ignore all type annotation rules in test folders
160160
"ARG", # Ignore all unused argument warnings in test folders

0 commit comments

Comments
 (0)