Skip to content

Commit

Permalink
Add spell check and ensure docstrings (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Dec 23, 2022
1 parent 0fac9e5 commit 00ed92e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
test_docs:
name: Test Docs
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
Expand All @@ -95,7 +95,7 @@ jobs:
run: |
hatch run typing:test
hatch run lint:style
pipx run 'validate-pyproject[all]' pyproject.toml
pipx run interrogate -v .
pipx run doc8 --max-line-length=200
make_sdist:
Expand Down
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: forbid-new-submodules
- id: check-builtin-literals
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
Expand All @@ -34,7 +35,7 @@ repos:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.178
rev: v0.0.189
hooks:
- id: ruff
args: ["--fix"]
7 changes: 7 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
"sphinxcontrib_github_alt",
]

try:
import enchant # type:ignore # noqa

extensions += ["sphinxcontrib.spelling"]
except ImportError:
pass

github_project_url = "https://github.com/jupyter/jupyter_core"

# Add any paths that contain templates here, relative to this directory.
Expand Down
1 change: 1 addition & 0 deletions jupyter_core/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def _dispatching(self):

@catch_config_error
def initialize(self, argv=None):
"""Initialize the application."""
# don't hook up crash handler before parsing command-line
if argv is None:
argv = sys.argv[1:]
Expand Down
4 changes: 4 additions & 0 deletions jupyter_core/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@


class JupyterParser(argparse.ArgumentParser):
"""A Jupyter argument parser."""

@property
def epilog(self):
"""Add subcommands to epilog on request
Expand All @@ -37,6 +39,7 @@ def epilog(self, x):


def jupyter_parser() -> JupyterParser:
"""Create a jupyter parser object."""
parser = JupyterParser(
description="Jupyter: Interactive Computing",
)
Expand Down Expand Up @@ -171,6 +174,7 @@ def _path_with_self():


def main() -> None:
"""The command entry point."""
parser = jupyter_parser()
if len(sys.argv) > 1 and not sys.argv[1].startswith("-"):
# Don't parse if a subcommand is given
Expand Down
3 changes: 3 additions & 0 deletions jupyter_core/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ def migrate():


class JupyterMigrate(JupyterApp):
"""A Jupyter Migration App."""

name = "jupyter-migrate"
description = """
Migrate configuration and data from .ipython prior to 4.0 to Jupyter locations.
Expand All @@ -263,6 +265,7 @@ class JupyterMigrate(JupyterApp):
"""

def start(self):
"""Start the application."""
if not migrate():
self.log.info("Found nothing to migrate.")

Expand Down
2 changes: 2 additions & 0 deletions jupyter_core/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ def secure_write(fname: str, binary: bool = False) -> Iterator[Any]:


def issue_insecure_write_warning() -> None:
"""Issue an insecure write warning."""

def format_warning(msg, *args, **kwargs):
return str(msg) + "\n"

Expand Down
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ test = [
docs = [
"myst-parser",
"sphinxcontrib_github_alt",
"sphinxcontrib_spelling",
"traitlets",
]

Expand Down Expand Up @@ -88,7 +89,7 @@ dependencies = ["mypy>=0.990"]
test = "mypy --install-types --non-interactive {args:.}"

[tool.hatch.envs.lint]
dependencies = ["black==22.10.0", "mdformat>0.7", "ruff==0.0.178"]
dependencies = ["black==22.10.0", "mdformat>0.7", "ruff==0.0.189"]
detached = true
[tool.hatch.envs.lint.scripts]
style = [
Expand Down Expand Up @@ -208,5 +209,15 @@ unfixable = [
# F821 Undefined name `get_config`
"jupyter_core/tests/**/profile_default/*_config.py" = ["F821"]

[tool.interrogate]
ignore-init-module=true
ignore-private=true
ignore-semiprivate=true
ignore-property-decorators=true
ignore-nested-functions=true
ignore-nested-classes=true
fail-under=100
exclude = ["docs", "*/tests"]

[tool.check-wheel-contents]
toplevel = ["jupyter_core/", "jupyter.py"]

0 comments on commit 00ed92e

Please sign in to comment.