Skip to content

Commit 63061ec

Browse files
authored
chore(lint): enable Ruff's pydocstyle (D) rules (#15)
This commit updates the linter configuration to enable the `pydocstyle` rule set, which is identified by the "D" prefix in Ruff. Enforcing docstring conventions will help improve code clarity and make the project easier to maintain and for new contributors to understand.
1 parent 81fbb39 commit 63061ec

File tree

12 files changed

+30
-18
lines changed

12 files changed

+30
-18
lines changed

examples/django/datastar/asgi.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
ASGI config for datastar project.
1+
"""ASGI config for datastar project.
32
43
It exposes the ASGI callable as a module-level variable named ``application``.
54

examples/django/datastar/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
Django settings for datastar project.
1+
"""Django settings for datastar project.
32
43
Generated by 'django-admin startproject' using Django 4.2.16.
54

examples/django/datastar/urls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
"""
2-
URL configuration for datastar project.
1+
"""URL configuration for datastar project.
32
43
The `urlpatterns` list routes URLs to views. For more information please see:
54
https://docs.djangoproject.com/en/4.2/topics/http/urls/
5+
66
Examples:
77
Function views
88
1. Add an import: from my_app import views
@@ -13,6 +13,7 @@
1313
Including another URLconf
1414
1. Import the include() function: from django.urls import include, path
1515
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16+
1617
"""
1718

1819
from django.contrib import admin

examples/django/datastar/wsgi.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
WSGI config for datastar project.
1+
"""WSGI config for datastar project.
32
43
It exposes the WSGI callable as a module-level variable named ``application``.
54
@@ -20,7 +19,7 @@
2019
original_is_hop_by_hop = wsgiref.handlers.is_hop_by_hop
2120

2221
def custom_is_hop_by_hop(header_name):
23-
"""Permit the "connection" header over WSGI
22+
"""Permit the "connection" header over WSGI.
2423
2524
Datastar by default, sets the connection header to "keep-alive".
2625
Per the WSGI spec (see below), wsgiref does not permit setting

pyproject.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ lint.select = [
5656
"ANN",
5757
# flake8-bugbear
5858
"B",
59+
"D",
5960
# pycodestyle
6061
"E",
6162
# Pyflakes
@@ -69,7 +70,19 @@ lint.select = [
6970
# pyupgrade
7071
"UP",
7172
]
72-
lint.ignore = [ "E501" ]
73+
lint.ignore = [
74+
"D100", # undocumented-public-module
75+
"D101", # undocumented-public-class
76+
"D102", # undocumented-public-method
77+
"D103", # undocumented-public-function
78+
"D104", # undocumented-public-package
79+
"D107", # undocumented-public-init
80+
"D203", # Conflicting with other rules
81+
"D213", # Conflicting with other rules
82+
"D401", # non-imperative-mood
83+
"D415", # Duplicate of D400
84+
"E501",
85+
]
7386
lint.fixable = [ "ALL" ]
7487

7588
per-file-ignores."examples/**/*.py" = [ "ANN" ]

sdk-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# datastar-py = { path = "." }
99
# ///
1010

11-
"""
12-
Runs a test server that the SDK tests can be run against.
11+
"""Runs a test server that the SDK tests can be run against.
12+
1313
1. Start this server with `uv run sdk-test.py`
1414
2. Move to the sdk/tests folder.
1515
3. Run `test-all.sh http://127.0.0.1:8000` to run the tests.

src/datastar_py/attributes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def show(self, expression: str) -> BaseAttr:
257257
return BaseAttr("show", value=expression, alias=self._alias)
258258

259259
def style(self, style_dict: Mapping | None = None, /, **styles: str) -> BaseAttr:
260-
"""Sets the value of inline CSS styles on an element based on an expression, and keeps them in sync."""
260+
"""Set the value of inline CSS styles on an element based on an expression, and keeps them in sync."""
261261
styles = {**(style_dict if style_dict else {}), **styles}
262262
return BaseAttr("style", value=_js_object(styles), alias=self._alias)
263263

src/datastar_py/django.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
class DatastarResponse(_StreamingHttpResponse):
22-
"""Respond with 0..N `DatastarEvent`s"""
22+
"""Respond with 0..N `DatastarEvent`s."""
2323

2424
default_headers: dict[str, str] = SSE_HEADERS.copy()
2525

src/datastar_py/litestar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
class DatastarResponse(Stream):
31-
"""Respond with 0..N `DatastarEvent`s"""
31+
"""Respond with 0..N `DatastarEvent`s."""
3232

3333
default_headers: dict[str, str] = SSE_HEADERS.copy()
3434

src/datastar_py/quart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
class DatastarResponse(Response):
22-
"""Respond with 0..N `DatastarEvent`s"""
22+
"""Respond with 0..N `DatastarEvent`s."""
2323

2424
default_headers: dict[str, str] = SSE_HEADERS.copy()
2525

0 commit comments

Comments
 (0)