Skip to main content

all: use ruff instead of interrogate for docstring linting

ID
b0fe269
date
2026-04-16 08:10:58+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
2d1ce71
message
all: use ruff instead of interrogate for docstring linting
changed files
7 files, 22 additions, 33 deletions

Changed files

dev_requirements.in (51) → dev_requirements.in (39)

diff --git a/dev_requirements.in b/dev_requirements.in
index 2e118f1..01556c1 100644
--- a/dev_requirements.in
+++ b/dev_requirements.in
@@ -1,6 +1,5 @@
 -e file:.[typed]
 
-interrogate
 mypy
 pytest-cov
 ruff

dev_requirements.txt (1244) → dev_requirements.txt (1011)

diff --git a/dev_requirements.txt b/dev_requirements.txt
index 32b58c2..63d3d33 100644
--- a/dev_requirements.txt
+++ b/dev_requirements.txt
@@ -4,18 +4,10 @@
     # via -r dev_requirements.in
 annotated-types==0.7.0
     # via pydantic
-attrs==26.1.0
-    # via interrogate
-click==8.3.2
-    # via interrogate
-colorama==0.4.6
-    # via interrogate
 coverage==7.13.5
     # via pytest-cov
 iniconfig==2.3.0
     # via pytest
-interrogate==1.7.0
-    # via -r dev_requirements.in
 librt==0.8.1
     # via mypy
 mypy==1.20.0
@@ -30,22 +22,18 @@ pluggy==1.6.0
     # via
     #   pytest
     #   pytest-cov
-py==1.11.0
-    # via interrogate
 pydantic==2.12.5
     # via javascript-data-files
 pydantic-core==2.41.5
     # via pydantic
 pygments==2.20.0
     # via pytest
-pytest==9.0.2
+pytest==9.0.3
     # via pytest-cov
 pytest-cov==7.1.0
     # via -r dev_requirements.in
 ruff==0.15.9
     # via -r dev_requirements.in
-tabulate==0.10.0
-    # via interrogate
 typing-extensions==4.15.0
     # via
     #   mypy

pyproject.toml (1324) → pyproject.toml (1516)

diff --git a/pyproject.toml b/pyproject.toml
index 7fac197..635978d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -55,7 +55,12 @@ filterwarnings = ["error"]
 mypy_path = "src"
 strict = true
 
-[tool.interrogate]
-fail_under = 100
-omit-covered-files = true
-ignore-nested-classes = true
+[tool.ruff.lint]
+select = ["D", "E", "F"]
+ignore = [
+    "D200",  # unnecessary-multiline-docstring
+    "D203",  # incorrect-blank-line-before-class
+    "D205",  # missing-blank-line-after-summary
+    "D211",  # blank-line-before-class
+    "D212",  # multi-line-summary-first-line
+]

src/javascript_data_files/__init__.py (6906) → src/javascript_data_files/__init__.py (6922)

diff --git a/src/javascript_data_files/__init__.py b/src/javascript_data_files/__init__.py
index 2797870..3e9ab9f 100644
--- a/src/javascript_data_files/__init__.py
+++ b/src/javascript_data_files/__init__.py
@@ -1,7 +1,6 @@
 """
-This is a collection of Python functions for manipulating JavaScript
-"data files" -- that is, JavaScript files that define a single variable
-with a JSON value.
+Python functions for manipulating JavaScript "data files" -- that is,
+JavaScript files that define a single variable with a JSON value.
 
 This is an example of a JavaScript data file:
 
@@ -77,13 +76,12 @@ def write_js(
     ensure_ascii: bool = False,
     sort_keys: bool = False,
 ) -> None:
-    """
+    r"""
     Write a JavaScript "data file".
 
     You can pass a path-like or file-like object as the first parameter ``p``.
 
     Example:
-
         >>> red_pentagon = {'sides': 5, 'colour': 'red'}
         >>> write_js('shape.js', value=red_pentagon, varname='redPentagon')
         >>> open('shape.js').read()
@@ -134,7 +132,6 @@ def append_to_js_array(p: pathlib.Path | str, *, value: typing.Any) -> None:
     Append a single value to an array in a JavaScript "data file".
 
     Example:
-
         >>> write_js('food.js', value=['apple', 'banana', 'coconut'], varname='fruit')
         >>> append_to_js_array('food.js', value='damson')
         >>> read_js('food.js', varname='fruit')
@@ -187,8 +184,9 @@ def append_to_js_object(p: pathlib.Path | str, *, key: str, value: typing.Any) -
     Append a single key/value pair to a JSON object in a JavaScript "data file".
 
     Example:
-
-        >>> write_js('shape.js', value={'colour': 'red', 'sides': 5}, varname='redPentagon')
+        >>> write_js('shape.js',
+        ...          value={'colour': 'red', 'sides': 5},
+        ...          varname='redPentagon')
         >>> append_to_js_object('shape.js', key='sideLengths', value=[5, 5, 6, 6, 6])
         >>> read_js('shape.js', varname='redPentagon')
         {'colour': 'red', 'sides': 5, 'sideLengths': [5, 5, 6, 6, 6]}

src/javascript_data_files/decoder.py (2197) → src/javascript_data_files/decoder.py (2178)

diff --git a/src/javascript_data_files/decoder.py b/src/javascript_data_files/decoder.py
index be5efdf..fb7533f 100644
--- a/src/javascript_data_files/decoder.py
+++ b/src/javascript_data_files/decoder.py
@@ -1,6 +1,5 @@
 """
-This file contains pure functions for converting JSON strings
-to Python values.
+Pure functions for converting JSON strings to Python values.
 
 Because I expect some of this JSON to be written by me, and I can
 make copy-paste mistakes, there are a couple of ways it tries

src/javascript_data_files/encoder.py (1439) → src/javascript_data_files/encoder.py (1420)

diff --git a/src/javascript_data_files/encoder.py b/src/javascript_data_files/encoder.py
index 4c90db6..0283da7 100644
--- a/src/javascript_data_files/encoder.py
+++ b/src/javascript_data_files/encoder.py
@@ -1,6 +1,5 @@
 """
-This file contains pure functions for converting Python values
-to JavaScript strings.
+Pure functions for converting Python values to JavaScript strings.
 
 We prioritise human-readability over absolute efficiency.
 For example, JSON is nicely indented to be more readable, rather than

tests/test_javascript_data_files.py (19158) → tests/test_javascript_data_files.py (19158)

diff --git a/tests/test_javascript_data_files.py b/tests/test_javascript_data_files.py
index a6a625b..666dd74 100644
--- a/tests/test_javascript_data_files.py
+++ b/tests/test_javascript_data_files.py
@@ -21,7 +21,7 @@ from javascript_data_files import (
 @pytest.fixture
 def js_path(tmp_path: pathlib.Path) -> pathlib.Path:
     """
-    Returns a path to a JavaScript file.
+    Return a path to a JavaScript file.
 
     This only returns the path and does not create the file.
     """
@@ -45,8 +45,9 @@ class TestReadJs:
     )
     def test_can_read_file(self, js_path: pathlib.Path, text: str) -> None:
         """
-        JavaScript "data values" can be read from files, with a certain
-        amount of allowance for:
+        Test values can be read from a file correctly.
+
+        Test that the parser does not care about:
 
         *   whitespace
         *   trailing semicolon or not