Skip to content

Commit dfd340f

Browse files
authored
Add spelling and docstring enforcement (#358)
1 parent 6666e17 commit dfd340f

21 files changed

+77
-23
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ jobs:
5555
run: |
5656
hatch run typing:test
5757
hatch run lint:style
58-
pipx run 'validate-pyproject[all]' pyproject.toml
58+
pipx run interrogate -v .
5959
pipx run doc8 --max-line-length=200
6060
6161
docs:
62-
runs-on: ubuntu-latest
62+
runs-on: windows-latest
6363
steps:
6464
- uses: actions/checkout@v3
6565
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
66
rev: v4.4.0
77
hooks:
8-
- id: end-of-file-fixer
98
- id: check-case-conflict
9+
- id: check-ast
10+
- id: check-docstring-first
1011
- id: check-executables-have-shebangs
11-
- id: requirements-txt-fixer
1212
- id: check-added-large-files
1313
- id: check-case-conflict
14+
- id: check-merge-conflict
15+
- id: check-json
1416
- id: check-toml
1517
- id: check-yaml
16-
- id: debug-statements
17-
- id: forbid-new-submodules
18-
- id: check-builtin-literals
18+
- id: end-of-file-fixer
1919
- id: trailing-whitespace
2020

2121
- repo: https://github.com/python-jsonschema/check-jsonschema
@@ -36,7 +36,7 @@ repos:
3636
- id: black
3737

3838
- repo: https://github.com/charliermarsh/ruff-pre-commit
39-
rev: v0.0.165
39+
rev: v0.0.189
4040
hooks:
4141
- id: ruff
4242
args: ["--fix"]

jupyterlab_server/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""CLI entry point for jupyterlab server."""
12
import sys
23

34
from jupyterlab_server.app import main

jupyterlab_server/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ def _deprecated_trait(self, change):
9898
setattr(self, new_attr, change.new)
9999

100100
def initialize_templates(self):
101+
"""Initialize templates."""
101102
self.static_paths = [self.static_dir]
102103
self.template_paths = [self.templates_dir]
103104

104105
def initialize_handlers(self):
106+
"""Initialize handlers."""
105107
add_handlers(self.handlers, self)
106108

107109

jupyterlab_server/handlers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,11 @@ def get(self, mode=None, workspace=None, tree=None):
157157

158158

159159
class NotFoundHandler(LabHandler):
160+
"""A handler for page not found."""
161+
160162
@lru_cache() # noqa
161163
def get_page_config(self):
164+
"""Get the page config."""
162165
page_config = super().get_page_config()
163166
page_config["notFoundUrl"] = self.request.path
164167
return page_config

jupyterlab_server/licenses_app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class MyApp(JupyterApp, LabConfig):
3030

3131

3232
class LicensesApp(JupyterApp, LabConfig):
33+
"""A license management app."""
34+
3335
version = __version__
3436

3537
description = """
@@ -71,15 +73,18 @@ class LicensesApp(JupyterApp, LabConfig):
7173
}
7274

7375
def initialize(self, *args, **kwargs):
76+
"""Initialize the app."""
7477
super().initialize(*args, **kwargs)
7578
self.init_licenses_manager()
7679

7780
def init_licenses_manager(self):
81+
"""Initialize the license manager."""
7882
self.licenses_manager = LicensesManager(
7983
parent=self,
8084
)
8185

8286
def start(self):
87+
"""Start the app."""
8388
report = self.licenses_manager.report(
8489
report_format=self.report_format,
8590
full_text=self.full_text,

jupyterlab_server/licenses_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ class LicensesHandler(APIHandler):
234234
"""A handler for serving licenses used by the application"""
235235

236236
def initialize(self, manager: LicensesManager) -> None:
237+
"""Initialize the handler."""
237238
super().initialize()
238239
self.manager = manager
239240

jupyterlab_server/process.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
else:
2828

2929
def list2cmdline(cmd_list):
30+
"""Shim for list2cmdline on posix."""
3031
import shlex
3132

3233
return " ".join(map(shlex.quote, cmd_list))
@@ -179,6 +180,7 @@ def _cleanup(cls):
179180
proc.terminate()
180181

181182
def get_log(self):
183+
"""Get our logger."""
182184
if hasattr(self, "logger") and self.logger:
183185
return self.logger
184186
# fallback logger

jupyterlab_server/process_app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def initialize_settings(self):
2727
IOLoop.current().add_callback(self._run_command)
2828

2929
def initialize_handlers(self):
30+
"""Initialize the handlers."""
3031
add_handlers(self.handlers, self)
3132

3233
def _run_command(self):

jupyterlab_server/pytest_plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""pytest fixtures."""
12
import json
23
import os
34
import os.path as osp
@@ -12,6 +13,7 @@
1213

1314

1415
def mkdir(tmp_path, *parts):
16+
"""Util for making a directory."""
1517
path = tmp_path.joinpath(*parts)
1618
if not path.exists():
1719
path.mkdir(parents=True)
@@ -37,8 +39,10 @@ def make_labserver_extension_app(
3739
workspaces_dir,
3840
labextensions_dir,
3941
):
40-
def _make_labserver_extension_app(**kwargs):
42+
"""Return a factory function for a labserver extension app."""
4143

44+
def _make_labserver_extension_app(**kwargs):
45+
"""Factory function for lab server extension apps."""
4246
return LabServerApp(
4347
static_dir=str(jp_root_dir),
4448
templates_dir=str(jp_template_dir),
@@ -127,6 +131,7 @@ def _make_labserver_extension_app(**kwargs):
127131

128132
@pytest.fixture
129133
def labserverapp(jp_serverapp, make_labserver_extension_app):
134+
"""A lab server app."""
130135
app = make_labserver_extension_app()
131136
app._link_jupyter_server_extension(jp_serverapp)
132137
app.initialize()

0 commit comments

Comments
 (0)