浏览代码

Code spell checking on every test run!

Dan Helfman 2 年之前
父节点
当前提交
2934d0902c
共有 6 个文件被更改,包括 27 次插入9 次删除
  1. 1 1
      borgmatic/borg/check.py
  2. 8 8
      borgmatic/config/schema.yaml
  3. 8 0
      docs/how-to/develop-on-borgmatic.md
  4. 3 0
      setup.cfg
  5. 1 0
      test_requirements.txt
  6. 6 0
      tox.ini

+ 1 - 1
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.
 

+ 8 - 8
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

+ 8 - 0
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

+ 3 - 0
setup.cfg

@@ -20,3 +20,6 @@ known_first_party = borgmatic
 line_length = 100
 multi_line_output = 3
 skip = .tox
+
+[codespell]
+skip = .git,.tox,build

+ 1 - 0
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

+ 6 - 0
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