Skip to content

Commit

Permalink
chore(scripts): remove check_spelling.py (#2063)
Browse files Browse the repository at this point in the history
Followup to #2060, check_spelling.py is not needed as codespell can be run directly. Update pixi and vscode tasks to use codespell directly.
  • Loading branch information
wpbonelli authored Nov 18, 2024
1 parent ef3a194 commit ad27bd1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[codespell]
skip = *.pdf,*.grb,*.bib,*.bst,./src/Utilities/Libraries/*,./utils/mf5to6/*
skip = *.pdf,*.grb,*.bib,*.bst,*.log,./src/Utilities/Libraries/*,./utils/mf5to6/*
ignore-words = .codespell.ignore
133 changes: 0 additions & 133 deletions .github/common/check_spelling.py

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@
{
"label": "Check spelling",
"type": "shell",
"command": "python .github/common/check_spelling.py",
"command": "codespell",
"options": {"cwd": "${workspaceFolder}"},
"group": {
"kind": "build",
Expand Down
15 changes: 4 additions & 11 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,26 +361,19 @@ pixi run build builddir

Fortran source files, python files, definition files, markdown, and LaTeX files can be checked with [codespell](https://github.com/codespell-project/codespell). codespell was designed primarily for checking misspelled words in source code, but it can be used with other text files as well. The `codespell` package is included in the Conda `environment.yml` and the Pixi `pixi.toml` files and can be run directly, via Pixi, or via [VSCode](.vscode/README.md) tasks.

For instance, to format a single file:

```shell
python .github/common/check_spelling.py -p ./utils/zonebudget/src/zbud6.f90 --write-changes
```
When run in this way, the tool will modify the file in place. If unresolvable errors are encountered, these are written to standard output and must be manually fixed before attempting to rerun the tool.

To check whether the repository's Fortran source files, python files, definition files, markdown, and LaTeX files have any spelling errors without making any changes:

```shell
python .github/common/check_spelling.py
pixi run check-spelling
```

or using pixi:
Or, from an environment with `codespell` installed, simply

```shell
pixi run check-spelling
codespell
```

To fix spelling errors in all files, add the `--write-changes` flag to the end of the python or pixi commands.
To fix spelling errors in all files, use `-w` (`--write-changes`). When run in this way, the tool will modify the file in place. If unresolvable errors are encountered, these are written to standard output and must be manually fixed before attempting to rerun the tool.

**Note**: Spell checking by codespell may make unwanted changes (for example, a variable name in source code). As a result, you should check the `codespell` changes. codespell can be forced to leave a particular word unchanged by adding it to the `.codespell.ignore` file.

Expand Down
2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ install = { depends_on = [
# check format
check-format = "python .github/common/check_format.py"
check-vfproj = "python .github/common/check_vfproj.py"
check-spelling = "python .github/common/check_spelling.py"
check-spelling = "codespell"
check-python-lint = { cmd = "ruff check ." }
check-python-format = { cmd = "pixi run fix-python-format --check" }

Expand Down

0 comments on commit ad27bd1

Please sign in to comment.