diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5ff61343..cd8f089b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -66,14 +66,11 @@ repos: types_or: [yaml, markdown, html, css, scss, javascript, json] args: [--prose-wrap=always] - - repo: https://github.com/codespell-project/codespell - rev: "v2.4.1" + - repo: https://github.com/crate-ci/typos + rev: "v1.40.0" hooks: - - id: codespell + - id: typos exclude: ^Gemfile\.lock$ - additional_dependencies: - - tomli; python_version<'3.11' - args: ["-w"] - repo: local hooks: diff --git a/docs/pages/guides/gha_basic.md b/docs/pages/guides/gha_basic.md index 24fd37f8..81baaca7 100644 --- a/docs/pages/guides/gha_basic.md +++ b/docs/pages/guides/gha_basic.md @@ -206,7 +206,7 @@ actions have outputs, and bash actions can manually write to output: You can now refer to this step in a later step with `${{ steps.someid.something }}`. You also can get it from another job by using `${{ needs..outputs.something }}`. The `toJson()` function is useful -for inputing JSON - you can even generate matrices dynamically this way! +for inputting JSON - you can even generate matrices dynamically this way! {% endraw %} diff --git a/docs/pages/guides/style.md b/docs/pages/guides/style.md index d39e9825..f4eff7d3 100644 --- a/docs/pages/guides/style.md +++ b/docs/pages/guides/style.md @@ -745,9 +745,13 @@ Make sure you list the highest version of Python you are testing with here. ## Spelling {% rr PC160 %} You can and should check for spelling errors in your code too. If -you want to add this, you can use [codespell][] for common spelling mistakes. -Unlike most spell checkers, this has a list of mistakes it looks for, rather -than a list of "valid" words. To use: +you want to add this, you can use a code-ready spell checker for common spelling +mistakes. Unlike most spell checkers, these have a list of mistakes they look +for, rather than a list of "valid" words. To use: + +{% tabs spell %} {% tab codespell codespell %} + +If you want a Python based tool, [codespell] is the classic tool used. ```yaml - repo: https://github.com/codespell-project/codespell @@ -772,6 +776,37 @@ You can also add the `-w` flag to have it automatically correct errors - this is very helpful to quickly make corrections if you have a lot of them when first adding the check. `uvx codespell -w` will quickly correct all non-hidden files. +{% endtab %} {% tab typos typos %} + +A rust rewrite of [codespell][], [typos][] has a defining feature: It can find +typos in CamelCase or snake_case variable names. It also is probably faster, +though codespell is very fast too. This one is not available on PyPI, use +pre-commit, gh-install, brew, cargo, or conda/pixi. It also has LSP (VSCode) +integration. + +```yaml +- repo: https://github.com/crate-ci/typos + rev: "v1.40.0" + hooks: + - id: typos + args: [] +``` + +To configure it, you can use this section in `pyproject.toml`: + +```toml +[tool.typos.default.extend-words] +nd = "nd" +sur = "sur" +``` + +It has quite a few supported configuration options, like adding your own +corrections, feel free to check the [full reference][typos-ref]. If you want it +to write changes, you can remove the `args: []` in the pre-commit hook, or add +`-w` when running it locally. + +{% endtab %} {% endtabs %} + You can also use a local pygrep check to eliminate common capitalization errors, such as the one below: @@ -992,6 +1027,8 @@ You also might like the following hook, which cleans Jupyter outputs: [check-jsonschema]: https://check-jsonschema.readthedocs.io/en/latest/ [cjs-common]: https://check-jsonschema.readthedocs.io/en/latest/precommit_usage.html#supported-hooks [schemastore]: https://schemastore.org +[typos]: https://github.com/crate-ci/typos +[typos-ref]: https://github.com/crate-ci/typos/blob/master/docs/reference.md diff --git a/docs/pages/principles/testing.md b/docs/pages/principles/testing.md index 2810981a..24385915 100644 --- a/docs/pages/principles/testing.md +++ b/docs/pages/principles/testing.md @@ -168,7 +168,7 @@ import pytest @pytest.mark.slow -def test_somthing_slow(): ... +def test_something_slow(): ... ``` To mark every test in a directory, add the following to the `conftest.py` in the @@ -626,8 +626,8 @@ much more complex and difficult to read for new developers. ## Diagnostic Tests Diagnostic tests are used to verify the installation of a package. They should -be runable on production systems, like when we need to ssh into a live server to -troubleshoot problems. +be runnable on production systems, like when we need to ssh into a live server +to troubleshoot problems. A diagnostic test suite may contain any combination of tests you deem pertinent. You could include all the unit tests, or a specific subset of them. You may want diff --git a/pyproject.toml b/pyproject.toml index 245ca332..67585d2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -195,7 +195,6 @@ ignore = [ [tool.repo-review.ignore] RTD103 = "Using Ruby instead of Python for docs" -[tool.codespell] -ignore-words-list = [ - "nd", -] +[tool.typos.default.extend-words] +nd = "nd" +sur = "sur"