From 2934d0902c8ec26b4d1cc2c93e4a46f7801eeb67 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sat, 1 Apr 2023 11:03:59 -0700 Subject: [PATCH] Code spell checking on every test run! --- borgmatic/borg/check.py | 2 +- borgmatic/config/schema.yaml | 16 ++++++++-------- docs/how-to/develop-on-borgmatic.md | 8 ++++++++ setup.cfg | 3 +++ test_requirements.txt | 1 + tox.ini | 6 ++++++ 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/borgmatic/borg/check.py b/borgmatic/borg/check.py index 4630782a..2c7c8fc5 100644 --- a/borgmatic/borg/check.py +++ b/borgmatic/borg/check.py @@ -147,7 +147,7 @@ def filter_checks_on_frequency( def make_check_flags(local_borg_version, storage_config, checks, check_last=None, prefix=None): ''' - Given the local Borg version, a storge configuration dict, a parsed sequence of checks, the + Given the local Borg version, a storage configuration dict, a parsed sequence of checks, the check last value, and a consistency check prefix, transform the checks into tuple of command-line flags. diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index 875c05c3..04b3c6ec 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -930,14 +930,14 @@ properties: type: string enum: ['sql'] description: | - Database dump output format. Currently only "sql" - is supported. Defaults to "sql" for a single - database. Or, when database name is "all" and - format is blank, dumps all databases to a single - file. But if a format is specified with an "all" - database name, dumps each database to a separate - file of that format, allowing more convenient - restores of individual databases. + Database dump output format. Currently only + "sql" is supported. Defaults to "sql" for a + single database. Or, when database name is "all" + and format is blank, dumps all databases to a + single file. But if a format is specified with + an "all" database name, dumps each database to a + separate file of that format, allowing more + convenient restores of individual databases. example: directory add_drop_database: type: boolean diff --git a/docs/how-to/develop-on-borgmatic.md b/docs/how-to/develop-on-borgmatic.md index 33346fae..ebc79c6f 100644 --- a/docs/how-to/develop-on-borgmatic.md +++ b/docs/how-to/develop-on-borgmatic.md @@ -73,6 +73,14 @@ can ask isort to order your imports for you: tox -e isort ``` +Similarly, if you get errors about spelling mistakes in source code, you can +ask codespell to correct them: + +```bash +tox -e codespell +``` + + ### End-to-end tests borgmatic additionally includes some end-to-end tests that integration test diff --git a/setup.cfg b/setup.cfg index 67b989dc..f97ae972 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,3 +20,6 @@ known_first_party = borgmatic line_length = 100 multi_line_output = 3 skip = .tox + +[codespell] +skip = .git,.tox,build diff --git a/test_requirements.txt b/test_requirements.txt index d34bc623..7910788b 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -2,6 +2,7 @@ appdirs==1.4.4; python_version >= '3.8' attrs==20.3.0; python_version >= '3.8' black==19.10b0; python_version >= '3.8' click==7.1.2; python_version >= '3.8' +codespell==2.2.4 colorama==0.4.4 coverage==5.3 flake8==4.0.1 diff --git a/tox.ini b/tox.ini index 17b7a9da..b81588af 100644 --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,7 @@ commands = py38,py39,py310,py311: black --check . isort --check-only --settings-path setup.cfg . flake8 borgmatic tests + codespell [testenv:black] commands = @@ -35,3 +36,8 @@ commands = deps = {[testenv]deps} commands = isort --settings-path setup.cfg . + +[testenv:codespell] +deps = {[testenv]deps} +commands = + codespell --write-changes