@@ -191,6 +191,60 @@ def remove_pyproject_configs(self) -> None:
191191 first_removal = False
192192
193193
194+ class CodespellTool (Tool ):
195+ @property
196+ def name (self ) -> str :
197+ return "Codespell"
198+
199+ @property
200+ def dev_deps (self ) -> list [Dependency ]:
201+ return [Dependency (name = "codespell" )]
202+
203+ def get_pyproject_configs (self ) -> list [PyProjectConfig ]:
204+ return [
205+ PyProjectConfig (
206+ id_keys = ["tool" , "codespell" ],
207+ value = {
208+ "ignore-words-list" : [],
209+ "ignore-regex" : [
210+ "[A-Za-z0-9+/]{100,}" # Ignore long base64 strings
211+ ],
212+ },
213+ ),
214+ ]
215+
216+ def get_pre_commit_repos (self ) -> list [LocalRepo | UriRepo ]:
217+ return [
218+ UriRepo (
219+ repo = "https://github.com/codespell-project/codespell" ,
220+ rev = "v2.4.1" , # Manually bump this version when necessary
221+ hooks = [
222+ HookDefinition (id = "codespell" , additional_dependencies = ["tomli" ])
223+ ],
224+ )
225+ ]
226+
227+ def get_pyproject_id_keys (self ) -> list [list [str ]]:
228+ return [["tool" , "codespell" ]]
229+
230+ def get_managed_files (self ) -> list [Path ]:
231+ return [Path (".codespellrc" )]
232+
233+ def get_bitbucket_steps (self ) -> list [BitbucketStep ]:
234+ return [
235+ BitbucketStep (
236+ name = "Run Codespell" ,
237+ caches = ["uv" ],
238+ script = BitbucketScript (
239+ [
240+ BitbucketScriptItemAnchor (name = "install-uv" ),
241+ "uv run codespell" ,
242+ ]
243+ ),
244+ )
245+ ]
246+
247+
194248class CoverageTool (Tool ):
195249 @property
196250 def name (self ) -> str :
@@ -495,6 +549,7 @@ def get_bitbucket_steps(self) -> list[BitbucketStep]:
495549
496550
497551ALL_TOOLS : list [Tool ] = [
552+ CodespellTool (),
498553 CoverageTool (),
499554 DeptryTool (),
500555 PreCommitTool (),
0 commit comments