New Upstream Release - python-doc8

Ready changes

Summary

Merged new upstream version: 0.11.2 (was: 0.10.1).

Diff

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b43309b..74f56b7 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,15 +1,15 @@
 ---
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.0.1  # Use the ref you want to point at
+    rev: v4.2.0  # Use the ref you want to point at
     hooks:
     - id: trailing-whitespace
     - id: check-yaml
     - id: end-of-file-fixer
     - id: trailing-whitespace
     - id: check-executables-have-shebangs
-  - repo: https://github.com/python/black
-    rev: 21.10b0
+  - repo: https://github.com/psf/black
+    rev: 22.3.0
     hooks:
       - id: black
   - repo: https://github.com/pycqa/flake8
@@ -17,7 +17,7 @@ repos:
     hooks:
       - id: flake8
   - repo: https://github.com/pre-commit/mirrors-mypy
-    rev: v0.910-1
+    rev: v0.950
     hooks:
       - id: mypy
         # empty args needed in order to match mypy cli behavior
@@ -28,9 +28,8 @@ repos:
           - types-mock
           - types-setuptools
           - types-docutils
-          - types-toml
   - repo: https://github.com/PyCQA/pylint
-    rev: v2.11.1
+    rev: v2.14.0-b1
     hooks:
       - id: pylint
         additional_dependencies:
diff --git a/README.rst b/README.rst
index 0c3a85c..5d6992d 100644
--- a/README.rst
+++ b/README.rst
@@ -65,7 +65,7 @@ Usage
 
     optional arguments:
       -h, --help            show this help message and exit
-      --config path         user config file location (default: doc8.ini, tox.ini,
+      --config path         user config file location (default: .config/doc8.ini, doc8.ini, tox.ini,
                             pep8.ini, setup.cfg).
       --allow-long-titles   allow long section titles (default: false).
       --ignore code         ignore the given error code(s).
@@ -98,10 +98,11 @@ the current working directory and that configuration path will be used
 instead.
 
 * ``$CWD/doc8.ini``
+* ``$CWD/.config/doc8.ini``
 * ``$CWD/tox.ini``
 * ``$CWD/pep8.ini``
 * ``$CWD/setup.cfg``
-* ``$CWD/pyproject.toml`` in section ``[tool.doc8]`` if ``toml`` is installed
+* ``$CWD/pyproject.toml`` in section ``[tool.doc8]`` if ``tomli`` is installed
 
 An example section that can be placed into one of these files::
 
diff --git a/debian/changelog b/debian/changelog
index f94abbc..df29ba4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+python-doc8 (0.11.2-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Tue, 22 Aug 2023 10:53:49 -0000
+
 python-doc8 (0.10.1-2) unstable; urgency=medium
 
   * Cleans better (Closes: #1048801).
diff --git a/src/doc8/main.py b/src/doc8/main.py
index a2ef5e2..b355362 100644
--- a/src/doc8/main.py
+++ b/src/doc8/main.py
@@ -36,7 +36,7 @@ import os
 import sys
 
 try:
-    import toml
+    import tomli
 
     HAVE_TOML = True
 except ImportError:
@@ -51,7 +51,7 @@ from doc8 import version
 
 FILE_PATTERNS = [".rst", ".txt"]
 MAX_LINE_LENGTH = 79
-CONFIG_FILENAMES = ["doc8.ini", "tox.ini", "pep8.ini", "setup.cfg"]
+CONFIG_FILENAMES = ["doc8.ini", ".config/doc8.ini", "tox.ini", "pep8.ini", "setup.cfg"]
 if HAVE_TOML:
     CONFIG_FILENAMES.extend(["pyproject.toml"])
 
@@ -134,7 +134,15 @@ def from_ini(fp):
 
 
 def from_toml(fp):
-    cfg = toml.load(fp).get("tool", {}).get("doc8", {})
+    with open(fp, "rb") as f:
+        parsed = tomli.load(f).get("tool", {}).get("doc8", {})
+
+    cfg = {}
+    for key, value in parsed.items():
+        if key == "ignore-path-errors":
+            value = parse_ignore_path_errors(value)
+        cfg[key.replace("-", "_")] = value
+
     return cfg
 
 
diff --git a/src/doc8/tests/test_main.py b/src/doc8/tests/test_main.py
index 1766f57..f52322c 100644
--- a/src/doc8/tests/test_main.py
+++ b/src/doc8/tests/test_main.py
@@ -7,7 +7,7 @@ from unittest.mock import patch, MagicMock
 import shutil
 import sys
 
-from doc8.main import main, doc8
+from doc8.main import main, doc8, from_toml
 
 
 # Location to create test files
@@ -426,3 +426,43 @@ class TestArguments(unittest.TestCase):
             state = main()
             self.assertEqual(state, 0)
             mock_scan.assert_not_called()
+
+
+CONFIG_TOML = """\
+[tool.doc8]
+allow-long-titles = true
+ignore-path-errors = ["foo.rst;D001;D002", "bar.rst;D002"]
+default-extension = ".rst"
+extension = [".rst", ".rST", ".txt", ".TXT"]
+ignore-path = ["baz.rst", "boff.rst"]
+ignore = ["D002", "D005"]
+max-line-length = 80
+file-encoding = "utf8"
+sphinx = false"""
+
+
+class TestConfig(unittest.TestCase):
+    """
+    Test that configuration file is loaded correctly
+    """
+
+    def test_config__from_toml(self):
+        with TmpFs() as tmpfs:
+            tmpfs.create_file("pyproject.toml", CONFIG_TOML)
+            cfg = from_toml(os.path.join(tmpfs.path, "pyproject.toml"))
+
+        self.assertEqual(cfg["allow_long_titles"], True)
+        self.assertEqual(
+            cfg["ignore_path_errors"],
+            {
+                "foo.rst": {"D001", "D002"},
+                "bar.rst": {"D002"},
+            },
+        )
+        self.assertEqual(cfg["default_extension"], ".rst")
+        self.assertEqual(cfg["extension"], [".rst", ".rST", ".txt", ".TXT"])
+        self.assertEqual(cfg["ignore_path"], ["baz.rst", "boff.rst"])
+        self.assertEqual(cfg["ignore"], ["D002", "D005"])
+        self.assertEqual(cfg["max_line_length"], 80)
+        self.assertEqual(cfg["file_encoding"], "utf8")
+        self.assertEqual(cfg["sphinx"], False)
diff --git a/test-requirements.txt b/test-requirements.txt
index 737a6b5..658e46a 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,3 +1,3 @@
 mock # BSD
 pytest # MIT
-toml # MIT
+tomli # MIT

More details

Full run details

Historical runs