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

[pydocstyle] Re-implement last-line-after-section (D413) #9654

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

charliermarsh
Copy link
Member

Summary

This rule was just incorrect, it didn't match the examples in the docs. (It's a very rarely-used rule since it's not included in any of the conventions.)

Closes #9452.

@charliermarsh charliermarsh added bug Something isn't working docstring Related to docstring linting or formatting labels Jan 26, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) January 26, 2024 19:25
@charliermarsh charliermarsh merged commit 157d5ba into main Jan 26, 2024
16 checks passed
@charliermarsh charliermarsh deleted the charlie/D413 branch January 26, 2024 19:31
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+2706 -0 violations, +0 -0 fixes in 7 projects; 36 projects unchanged)

DisnakeDev/disnake (+847 -0 violations, +0 -0 fixes)

+ disnake/abc.py:100:5: D413 [*] Missing blank line after last section ("Attributes")
+ disnake/abc.py:1073:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1153:9: D413 [*] Missing blank line after last section ("Raises")
+ disnake/abc.py:120:5: D413 [*] Missing blank line after last section ("Attributes")
+ disnake/abc.py:1288:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1377:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1528:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1803:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:180:5: D413 [*] Missing blank line after last section ("Attributes")
+ disnake/abc.py:1831:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1865:9: D413 [*] Missing blank line after last section ("Yields")
+ disnake/abc.py:1929:5: D413 [*] Missing blank line after last section ("Note")
+ disnake/abc.py:1961:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:228:5: D413 [*] Missing blank line after last section ("Attributes")
+ disnake/abc.py:530:9: D413 [*] Missing blank line after last section ("Returns")
... 832 additional changes omitted for project

apache/airflow (+14 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-preview --select ALL

+ airflow/decorators/base.py:131:5: D413 [*] Missing blank line after last section ("Example")
+ airflow/hooks/filesystem.py:27:5: D413 [*] Missing blank line after last section ("example")
+ airflow/io/path.py:254:9: D413 [*] Missing blank line after last section ("See Also")
+ airflow/models/dag.py:4055:5: D413 [*] Missing blank line after last section ("Args")
+ airflow/providers/amazon/aws/operators/base_aws.py:32:5: D413 [*] Missing blank line after last section ("Examples")
+ airflow/providers/amazon/aws/sensors/base_aws.py:32:5: D413 [*] Missing blank line after last section ("Examples")
+ airflow/providers/amazon/aws/utils/mixins.py:65:9: D413 [*] Missing blank line after last section ("Examples")
+ airflow/providers/apache/hive/hooks/hive.py:809:5: D413 [*] Missing blank line after last section ("Notes")
+ airflow/providers/fab/auth_manager/security_manager/override.py:1408:9: D413 [*] Missing blank line after last section ("NOTE")
+ airflow/providers/slack/hooks/slack.py:61:5: D413 [*] Missing blank line after last section ("Examples")
... 4 additional changes omitted for project

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

ruff check --no-cache --exit-zero --no-preview --select ALL

+ src/bokeh/application/application.py:250:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/application/handlers/directory.py:293:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/application/handlers/handler.py:199:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/application/handlers/request_handler.py:63:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/core/property/bases.py:160:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/core/property/container.py:247:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/core/property/dataspec.py:215:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/core/property/dataspec.py:442:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/driving.py:7:1: D413 [*] Missing blank line after last section ("Example")
+ src/bokeh/embed/elements.py:150:5: D413 [*] Missing blank line after last section ("Returns")
... 82 additional changes omitted for project

ibis-project/ibis (+494 -0 violations, +0 -0 fixes)

+ ibis/__init__.py:39:5: D413 [*] Missing blank line after last section ("Examples")
+ ibis/backends/base/__init__.py:100:9: D413 [*] Missing blank line after last section ("Returns")
+ ibis/backends/base/__init__.py:1063:9: D413 [*] Missing blank line after last section ("Returns")
+ ibis/backends/base/__init__.py:1098:9: D413 [*] Missing blank line after last section ("Parameters")
+ ibis/backends/base/__init__.py:110:9: D413 [*] Missing blank line after last section ("Returns")
+ ibis/backends/base/__init__.py:1114:9: D413 [*] Missing blank line after last section ("Parameters")
+ ibis/backends/base/__init__.py:1136:9: D413 [*] Missing blank line after last section ("Returns")
+ ibis/backends/base/__init__.py:1160:9: D413 [*] Missing blank line after last section ("Parameters")
+ ibis/backends/base/__init__.py:1174:9: D413 [*] Missing blank line after last section ("Examples")
+ ibis/backends/base/__init__.py:1222:9: D413 [*] Missing blank line after last section ("Parameters")
... 484 additional changes omitted for project

reflex-dev/reflex (+1241 -0 violations, +0 -0 fixes)

+ integration/benchmarks/benchmarks.py:12:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/benchmarks.py:48:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/benchmarks.py:75:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/helpers.py:16:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:104:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:114:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:30:9: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:39:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/test_compile_benchmark.py:51:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/test_compile_benchmark.py:70:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:80:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:90:5: D413 [*] Missing blank line after last section ("Args")
+ integration/conftest.py:16:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/conftest.py:37:5: D413 [*] Missing blank line after last section ("Args")
+ integration/conftest.py:68:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/test_background_task.py:104:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/test_background_task.py:121:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/test_background_task.py:139:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/test_background_task.py:164:5: D413 [*] Missing blank line after last section ("Args")
+ integration/test_call_script.py:233:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/test_call_script.py:250:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/test_call_script.py:267:5: D413 [*] Missing blank line after last section ("Returns")
... 1219 additional changes omitted for project

sphinx-doc/sphinx (+5 -0 violations, +0 -0 fixes)

+ sphinx/config.py:69:5: D413 [*] Missing blank line after last section ("Example")
+ sphinx/ext/autodoc/__init__.py:2448:5: D413 [*] Missing blank line after last section ("Example")
+ sphinx/ext/autodoc/__init__.py:2527:5: D413 [*] Missing blank line after last section ("Example")
+ tests/test_extensions/ext_napoleon_pep526_data_google.py:8:5: D413 [*] Missing blank line after last section ("Attributes")
+ tests/test_extensions/ext_napoleon_pep526_data_numpy.py:8:5: D413 [*] Missing blank line after last section ("Attributes")

zulip/zulip (+13 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-preview --select ALL

+ zerver/data_import/gitter.py:141:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/gitter.py:41:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/gitter.py:84:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:154:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:247:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:504:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:727:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:880:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack_message_conversion.py:140:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/lib/compatibility.py:55:5: D413 [*] Missing blank line after last section ("Returns")
... 3 additional changes omitted for project

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
D413 2706 2706 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+2706 -0 violations, +0 -0 fixes in 7 projects; 36 projects unchanged)

DisnakeDev/disnake (+847 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ disnake/abc.py:100:5: D413 [*] Missing blank line after last section ("Attributes")
+ disnake/abc.py:1073:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1153:9: D413 [*] Missing blank line after last section ("Raises")
+ disnake/abc.py:120:5: D413 [*] Missing blank line after last section ("Attributes")
+ disnake/abc.py:1288:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1377:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1528:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1803:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:180:5: D413 [*] Missing blank line after last section ("Attributes")
+ disnake/abc.py:1831:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:1865:9: D413 [*] Missing blank line after last section ("Yields")
+ disnake/abc.py:1929:5: D413 [*] Missing blank line after last section ("Note")
+ disnake/abc.py:1961:9: D413 [*] Missing blank line after last section ("Returns")
+ disnake/abc.py:228:5: D413 [*] Missing blank line after last section ("Attributes")
+ disnake/abc.py:530:9: D413 [*] Missing blank line after last section ("Returns")
... 832 additional changes omitted for project

apache/airflow (+14 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview --select ALL

+ airflow/decorators/base.py:131:5: D413 [*] Missing blank line after last section ("Example")
+ airflow/hooks/filesystem.py:27:5: D413 [*] Missing blank line after last section ("example")
+ airflow/io/path.py:254:9: D413 [*] Missing blank line after last section ("See Also")
+ airflow/models/dag.py:4055:5: D413 [*] Missing blank line after last section ("Args")
+ airflow/providers/amazon/aws/operators/base_aws.py:32:5: D413 [*] Missing blank line after last section ("Examples")
+ airflow/providers/amazon/aws/sensors/base_aws.py:32:5: D413 [*] Missing blank line after last section ("Examples")
+ airflow/providers/amazon/aws/utils/mixins.py:65:9: D413 [*] Missing blank line after last section ("Examples")
+ airflow/providers/apache/hive/hooks/hive.py:809:5: D413 [*] Missing blank line after last section ("Notes")
+ airflow/providers/fab/auth_manager/security_manager/override.py:1408:9: D413 [*] Missing blank line after last section ("NOTE")
+ airflow/providers/slack/hooks/slack.py:61:5: D413 [*] Missing blank line after last section ("Examples")
... 4 additional changes omitted for project

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

ruff check --no-cache --exit-zero --preview --select ALL

+ src/bokeh/application/application.py:250:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/application/handlers/directory.py:293:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/application/handlers/handler.py:199:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/application/handlers/request_handler.py:63:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/core/property/bases.py:160:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/core/property/container.py:247:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/core/property/dataspec.py:215:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/core/property/dataspec.py:442:9: D413 [*] Missing blank line after last section ("Returns")
+ src/bokeh/driving.py:7:1: D413 [*] Missing blank line after last section ("Example")
+ src/bokeh/embed/elements.py:150:5: D413 [*] Missing blank line after last section ("Returns")
... 82 additional changes omitted for project

ibis-project/ibis (+494 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ ibis/__init__.py:39:5: D413 [*] Missing blank line after last section ("Examples")
+ ibis/backends/base/__init__.py:100:9: D413 [*] Missing blank line after last section ("Returns")
+ ibis/backends/base/__init__.py:1063:9: D413 [*] Missing blank line after last section ("Returns")
+ ibis/backends/base/__init__.py:1098:9: D413 [*] Missing blank line after last section ("Parameters")
+ ibis/backends/base/__init__.py:110:9: D413 [*] Missing blank line after last section ("Returns")
+ ibis/backends/base/__init__.py:1114:9: D413 [*] Missing blank line after last section ("Parameters")
+ ibis/backends/base/__init__.py:1136:9: D413 [*] Missing blank line after last section ("Returns")
+ ibis/backends/base/__init__.py:1160:9: D413 [*] Missing blank line after last section ("Parameters")
+ ibis/backends/base/__init__.py:1174:9: D413 [*] Missing blank line after last section ("Examples")
+ ibis/backends/base/__init__.py:1222:9: D413 [*] Missing blank line after last section ("Parameters")
... 484 additional changes omitted for project

reflex-dev/reflex (+1241 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ integration/benchmarks/benchmarks.py:12:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/benchmarks.py:48:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/benchmarks.py:75:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/helpers.py:16:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:104:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:114:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:30:9: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:39:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/test_compile_benchmark.py:51:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/benchmarks/test_compile_benchmark.py:70:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:80:5: D413 [*] Missing blank line after last section ("Args")
+ integration/benchmarks/test_compile_benchmark.py:90:5: D413 [*] Missing blank line after last section ("Args")
+ integration/conftest.py:16:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/conftest.py:37:5: D413 [*] Missing blank line after last section ("Args")
+ integration/conftest.py:68:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/test_background_task.py:104:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/test_background_task.py:121:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/test_background_task.py:139:5: D413 [*] Missing blank line after last section ("Returns")
+ integration/test_background_task.py:164:5: D413 [*] Missing blank line after last section ("Args")
+ integration/test_call_script.py:233:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/test_call_script.py:250:5: D413 [*] Missing blank line after last section ("Yields")
+ integration/test_call_script.py:267:5: D413 [*] Missing blank line after last section ("Returns")
... 1219 additional changes omitted for project

sphinx-doc/sphinx (+5 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

+ sphinx/config.py:69:5: D413 [*] Missing blank line after last section ("Example")
+ sphinx/ext/autodoc/__init__.py:2448:5: D413 [*] Missing blank line after last section ("Example")
+ sphinx/ext/autodoc/__init__.py:2527:5: D413 [*] Missing blank line after last section ("Example")
+ tests/test_extensions/ext_napoleon_pep526_data_google.py:8:5: D413 [*] Missing blank line after last section ("Attributes")
+ tests/test_extensions/ext_napoleon_pep526_data_numpy.py:8:5: D413 [*] Missing blank line after last section ("Attributes")

zulip/zulip (+13 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview --select ALL

+ zerver/data_import/gitter.py:141:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/gitter.py:41:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/gitter.py:84:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:154:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:247:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:504:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:727:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack.py:880:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/data_import/slack_message_conversion.py:140:5: D413 [*] Missing blank line after last section ("Returns")
+ zerver/lib/compatibility.py:55:5: D413 [*] Missing blank line after last section ("Returns")
... 3 additional changes omitted for project

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
D413 2706 2706 0 0 0

@charliermarsh
Copy link
Member Author

I'm surprised so many projects have this rule enabled, I suspect it's an oversight.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

D413 rule doesn't work correctly
1 participant