Skip to content

BUG Warn on malformed parameter headers - #709

Merged
larsoner merged 1 commit into
numpy:mainfrom
jiewaishengzhi:fix-677-parameter-warning
Sep 25, 2026
Merged

larsoner merged 1 commit into
numpy:mainfrom
jiewaishengzhi:fix-677-parameter-warning

Conversation

@jiewaishengzhi

Copy link
Copy Markdown
Contributor

Closes #677.

NumpyDocString currently treats a malformed header such as val: int as the complete parameter name without warning. This change emits a focused warning when a parameter-like section contains : without the required preceding space.

The parsed output remains unchanged. Existing validator coverage continues to assert the structured PR10 diagnostic and now explicitly captures the parser warning.

Tests:

  • uvx pre-commit run --files numpydoc/docscrape.py numpydoc/tests/test_docscrape.py numpydoc/tests/test_validate.py
  • uv run --no-project --with-editable . --with pytest --with pytest-cov --with matplotlib python -m pytest -q (317 passed, 1 skipped, 2 xfailed)

@larsoner larsoner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @jiewaishengzhi !

@larsoner
larsoner merged commit c6f5df5 into numpy:main Sep 25, 2026
30 of 31 checks passed
@stefanv stefanv added this to the 1.11.0 milestone Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn on improperly formatted parameter definitions

3 participants