Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid removing newlines between docstring headers and rST blocks #11609

Merged
merged 1 commit into from
May 30, 2024

Conversation

charliermarsh
Copy link
Member

Given:

def func():
    """
    Example:

    .. code-block:: python

        import foo
    """

Removing the newline after the Example: header breaks Sphinx rendering.

See: #11577

@charliermarsh charliermarsh added bug Something isn't working docstring Related to docstring linting or formatting labels May 30, 2024
@charliermarsh
Copy link
Member Author

\cc @harupy

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+0 -93 violations, +0 -0 fixes in 2 projects; 48 projects unchanged)

bokeh/bokeh (+0 -92 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

- src/bokeh/command/subcommands/file_output.py:100:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/command/subcommands/file_output.py:70:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/command/util.py:193:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/json_encoder.py:103:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/core/property/any.py:60:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/color.py:100:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/descriptors.py:263:9: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/core/property/either.py:57:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/numeric.py:136:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/numeric.py:181:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/numeric.py:214:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/numeric.py:255:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/primitive.py:131:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/primitive.py:166:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/primitive.py:212:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/primitive.py:77:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/string.py:59:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/query.py:78:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/document/models.py:123:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/model/model.py:464:9: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/model/util.py:154:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/models/plots.py:157:9: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/models/sources.py:438:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/models/sources.py:493:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/models/tools.py:616:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/palettes.py:1696:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1725:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1754:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1783:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1812:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1845:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1874:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1906:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/_figure.py:309:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/plotting/glyph_api.py:1005:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:115:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:131:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:147:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:164:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:181:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:198:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:215:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:232:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:249:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:266:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:283:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:300:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:316:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:333:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
... 43 additional changes omitted for project

latchbio/latch (+0 -1 violations, +0 -0 fixes)

- latch/types/metadata.py:463:5: D412 [*] No blank lines allowed between a section header and its content ("Example")

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
D412 93 0 93 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -93 violations, +0 -0 fixes in 2 projects; 48 projects unchanged)

bokeh/bokeh (+0 -92 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

- src/bokeh/command/subcommands/file_output.py:100:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/command/subcommands/file_output.py:70:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/command/util.py:193:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/json_encoder.py:103:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/core/property/any.py:60:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/color.py:100:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/descriptors.py:263:9: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/core/property/either.py:57:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/numeric.py:136:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/numeric.py:181:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/numeric.py:214:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/numeric.py:255:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/primitive.py:131:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/primitive.py:166:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/primitive.py:212:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/primitive.py:77:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/property/string.py:59:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/core/query.py:78:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/document/models.py:123:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/model/model.py:464:9: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/model/util.py:154:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/models/plots.py:157:9: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/models/sources.py:438:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/models/sources.py:493:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/models/tools.py:616:5: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/palettes.py:1696:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1725:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1754:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1783:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1812:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1845:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1874:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/palettes.py:1906:5: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/_figure.py:309:9: D412 [*] No blank lines allowed between a section header and its content ("Example")
- src/bokeh/plotting/glyph_api.py:1005:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:115:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:131:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:147:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:164:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:181:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:198:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:215:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:232:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:249:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:266:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:283:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:300:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:316:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
- src/bokeh/plotting/glyph_api.py:333:1: D412 [*] No blank lines allowed between a section header and its content ("Examples")
... 43 additional changes omitted for project

latchbio/latch (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

- latch/types/metadata.py:463:5: D412 [*] No blank lines allowed between a section header and its content ("Example")

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
D412 93 0 93 0 0

@harupy
Copy link
Contributor

harupy commented May 30, 2024

@charliermarsh thanks for fixing this!

@charliermarsh charliermarsh merged commit 3aa7e35 into main May 30, 2024
19 checks passed
@charliermarsh charliermarsh deleted the charlie/sphinx-directive branch May 30, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docstring Related to docstring linting or formatting
3 participants