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

refactor(docs, ruff): Add pydocstyle rules #3493

Merged
merged 12 commits into from
Jul 22, 2024

Conversation

dangotbanned
Copy link
Member

@dangotbanned dangotbanned commented Jul 22, 2024

Follow-up discussed in: #3430 (comment)

This PR defines and applies a docstring style, for consistent and readable docs.

The style is based on numpydoc with some tweaks that have already been introduced to expr in #3466 (comment)

I have not added any new rules to that config.
However, testing on the generated code identified some rules that needed to be ignored.


This style is strictly applied to generated code only, until the final style has been approved.

One caveat is that docstring code formatting rules are not enabled yet - as they only affect non-generated code.

Based on vega#3466 (comment)

With some additional ignores added during test runs on `/v5/schema/*.py`
I should have updated in vega#3444 but the problem didn't become apparent until running through `ruff`
Rules are strictly only applied to autogenerated code currently, until the final style has been approved
@dangotbanned
Copy link
Member Author

dangotbanned commented Jul 22, 2024

@binste @mattijn @joelostblom @jonmmease

I've left this on draft for discussion, with the hope to apply whatever style is agreed upon to the rest of the codebase.
I wasn't planning on opening another PR before v5.4.0, but I've been writing more docs lately and have been missing the autofixes.

Just wanted to be clear that this is ready for "review", but I'm not looking to merge only the changes to generated code, if that makes sense?

@mattijn
Copy link
Contributor

mattijn commented Jul 22, 2024

All good from my side. Just one note, that you are surely already aware of, many code including docstrings is auto generated. Thus if you want to apply numpydoc formatting style to them it should be within the code that generate this.

@mattijn
Copy link
Contributor

mattijn commented Jul 22, 2024

I now see your line stating:

This style is strictly applied to generated code only

👍

@dangotbanned
Copy link
Member Author

dangotbanned commented Jul 22, 2024

All good from my side. Just one note, that you are surely already aware of, many code including docstrings is auto generated. Thus if you want to apply numpydoc formatting style to them it should be within the code that generate this.

I now see your line stating:

This style is strictly applied to generated code only

👍

Thanks @mattijn

For reference, running on the rest of the codebase:

# [tool.ruff.lint.per-file-ignores]
# Ignore `D` rules everywhere *except* for auto-generated code.
# "!altair/vegalite/v5/schema/*.py" = ["D","D213"]
>>> ruff check --statistics
Found 472 errors.
[*] 410 fixable with the `--fix` option.
195     D400    [*] ends-in-period
174     D213    [*] multi-line-summary-second-line
 59     D205    [ ] blank-line-after-summary      
 13     D200    [*] fits-on-one-line
 11     D202    [*] no-blank-line-after-function  
  6     D407    [*] dashed-underline-after-section
  4     D403    [*] first-line-capitalized        
  3     D209    [*] new-line-after-last-paragraph 
  3     D404    [ ] docstring-starts-with-this    
  1     D300    [*] triple-single-quotes
  1     D406    [*] new-line-after-section-name   
  1     D410    [*] no-blank-line-after-section   
  1     D411    [*] no-blank-line-before-section 

Showing the diff wouldn't be very helpful, but if you're interested in seeing examples for each code at pydocstyle-d

All 472 violations
altair\_magics.py:1:1: D200 [*] One-line docstring should fit on one line
altair\_magics.py:1:1: D400 [*] First line should end with a period
altair\_magics.py:39:5: D400 [*] First line should end with a period
altair\_magics.py:77:5: D213 [*] Multi-line docstring summary should start at the second line
altair\expr\__init__.py:915:9: D205 1 blank line required between summary line and description
altair\expr\core.py:7:5: D400 [*] First line should end with a period
altair\expr\core.py:21:9: D400 [*] First line should end with a period
altair\expr\core.py:29:5: D400 [*] First line should end with a period
altair\expr\core.py:166:5: D213 [*] Multi-line docstring summary should start at the second line
altair\expr\core.py:166:5: D400 [*] First line should end with a period
altair\jupyter\jupyter_chart.py:20:5: D200 [*] One-line docstring should fit on one line
altair\jupyter\jupyter_chart.py:20:5: D400 [*] First line should end with a period
altair\jupyter\jupyter_chart.py:50:5: D200 [*] One-line docstring should fit on one line
altair\jupyter\jupyter_chart.py:50:5: D400 [*] First line should end with a period
altair\jupyter\jupyter_chart.py:81:9: D205 1 blank line required between summary line and description
altair\jupyter\jupyter_chart.py:81:9: D400 [*] First line should end with a period
altair\jupyter\jupyter_chart.py:139:9: D400 [*] First line should end with a period
altair\jupyter\jupyter_chart.py:194:9: D205 1 blank line required between summary line and description
altair\jupyter\jupyter_chart.py:194:9: D400 [*] First line should end with a period
altair\jupyter\jupyter_chart.py:228:9: D205 1 blank line required between summary line and description
altair\jupyter\jupyter_chart.py:228:9: D400 [*] First line should end with a period
altair\jupyter\jupyter_chart.py:363:9: D205 1 blank line required between summary line and description
altair\jupyter\jupyter_chart.py:392:5: D400 [*] First line should end with a period
altair\utils\_dfi_types.py:58:9: D407 [*] Missing dashed underline after section ("Notes")
altair\utils\_dfi_types.py:58:9: D406 [*] Section name should end with a newline ("Notes")
altair\utils\_dfi_types.py:85:9: D205 1 blank line required between summary line and description
altair\utils\_dfi_types.py:106:5: D205 1 blank line required between summary line and description
altair\utils\_dfi_types.py:137:9: D200 [*] One-line docstring should fit on one line
altair\utils\_dfi_types.py:142:9: D200 [*] One-line docstring should fit on one line
altair\utils\_transformed_data.py:74:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_transformed_data.py:74:5: D400 [*] First line should end with a period
altair\utils\_transformed_data.py:160:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_transformed_data.py:160:5: D400 [*] First line should end with a period
altair\utils\_transformed_data.py:220:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_transformed_data.py:220:5: D400 [*] First line should end with a period
altair\utils\_transformed_data.py:273:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_transformed_data.py:273:5: D400 [*] First line should end with a period
altair\utils\_transformed_data.py:344:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_transformed_data.py:344:5: D400 [*] First line should end with a period
altair\utils\_transformed_data.py:408:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_transformed_data.py:408:5: D400 [*] First line should end with a period
altair\utils\_transformed_data.py:476:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_transformed_data.py:476:5: D400 [*] First line should end with a period
altair\utils\_transformed_data.py:508:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_transformed_data.py:508:5: D400 [*] First line should end with a period
altair\utils\_vegafusion_data.py:71:5: D400 [*] First line should end with a period
altair\utils\_vegafusion_data.py:90:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_vegafusion_data.py:90:5: D400 [*] First line should end with a period
altair\utils\_vegafusion_data.py:140:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_vegafusion_data.py:140:5: D400 [*] First line should end with a period
altair\utils\_vegafusion_data.py:167:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_vegafusion_data.py:167:5: D400 [*] First line should end with a period
altair\utils\_vegafusion_data.py:220:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\_vegafusion_data.py:220:5: D400 [*] First line should end with a period
altair\utils\_vegafusion_data.py:283:5: D400 [*] First line should end with a period
altair\utils\core.py:1:1: D200 [*] One-line docstring should fit on one line
altair\utils\core.py:1:1: D400 [*] First line should end with a period
altair\utils\core.py:216:5: D205 1 blank line required between summary line and description
altair\utils\core.py:216:5: D400 [*] First line should end with a period
altair\utils\core.py:261:5: D202 [*] No blank lines allowed after function docstring (found 1)
altair\utils\core.py:261:5: D205 1 blank line required between summary line and description
altair\utils\core.py:261:5: D400 [*] First line should end with a period
altair\utils\core.py:279:5: D202 [*] No blank lines allowed after function docstring (found 1)
altair\utils\core.py:279:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\core.py:322:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\core.py:455:5: D400 [*] First line should end with a period
altair\utils\core.py:485:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\core.py:510:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\core.py:510:5: D400 [*] First line should end with a period
altair\utils\core.py:691:5: D400 [*] First line should end with a period
altair\utils\core.py:725:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\core.py:725:5: D400 [*] First line should end with a period
altair\utils\core.py:884:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\core.py:907:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\core.py:907:5: D400 [*] First line should end with a period
altair\utils\data.py:117:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\data.py:245:5: D200 [*] One-line docstring should fit on one line
altair\utils\data.py:354:5: D400 [*] First line should end with a period
altair\utils\data.py:379:5: D400 [*] First line should end with a period
altair\utils\data.py:379:5: D403 [*] First word of the first line should be capitalized: `return` -> `Return`
altair\utils\data.py:416:5: D400 [*] First line should end with a period
altair\utils\deprecation.py:45:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\deprecation.py:84:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\display.py:59:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\display.py:121:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\display.py:168:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\display.py:198:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\display.py:208:5: D400 [*] First line should end with a period
altair\utils\execeval.py:6:5: D400 [*] First line should end with a period
altair\utils\execeval.py:26:5: D400 [*] First line should end with a period
altair\utils\html.py:229:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\html.py:229:5: D400 [*] First line should end with a period
altair\utils\mimebundle.py:72:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\mimebundle.py:72:5: D400 [*] First line should end with a period
altair\utils\mimebundle.py:177:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\mimebundle.py:177:5: D400 [*] First line should end with a period
altair\utils\mimebundle.py:290:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\mimebundle.py:290:5: D400 [*] First line should end with a period
altair\utils\mimebundle.py:329:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\mimebundle.py:329:5: D400 [*] First line should end with a period
altair\utils\mimebundle.py:329:5: D403 [*] First word of the first line should be capitalized: `read` -> `Read`
altair\utils\mimebundle.py:339:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\mimebundle.py:339:5: D400 [*] First line should end with a period
altair\utils\plugin_registry.py:22:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\plugin_registry.py:43:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\plugin_registry.py:43:5: D400 [*] First line should end with a period
altair\utils\plugin_registry.py:71:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\plugin_registry.py:98:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\plugin_registry.py:101:9: D407 [*] Missing dashed underline after section ("Parameters")
altair\utils\plugin_registry.py:109:9: D407 [*] Missing dashed underline after section ("References")
altair\utils\plugin_registry.py:133:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\plugin_registry.py:139:9: D407 [*] Missing dashed underline after section ("Parameters")
altair\utils\plugin_registry.py:146:9: D407 [*] Missing dashed underline after section ("Returns")
altair\utils\plugin_registry.py:168:9: D400 [*] First line should end with a period
altair\utils\plugin_registry.py:178:9: D400 [*] First line should end with a period
altair\utils\plugin_registry.py:211:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\plugin_registry.py:235:9: D400 [*] First line should end with a period
altair\utils\plugin_registry.py:240:9: D400 [*] First line should end with a period
altair\utils\save.py:22:5: D205 1 blank line required between summary line and description
altair\utils\save.py:22:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
altair\utils\save.py:22:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\save.py:22:5: D400 [*] First line should end with a period
altair\utils\save.py:34:5: D400 [*] First line should end with a period
altair\utils\save.py:57:5: D400 [*] First line should end with a period
altair\utils\save.py:93:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\save.py:93:5: D400 [*] First line should end with a period
altair\utils\schemapi.py:133:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:133:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:167:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:167:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:214:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:214:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
altair\utils\schemapi.py:214:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:226:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:279:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:279:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:279:5: D400 [*] First line should end with a period
altair\utils\schemapi.py:296:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:296:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:311:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:311:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:331:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:331:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:355:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:355:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:394:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:394:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:410:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:410:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:432:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:432:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:432:5: D400 [*] First line should end with a period
altair\utils\schemapi.py:460:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:460:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:512:5: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:512:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:534:5: D400 [*] First line should end with a period
altair\utils\schemapi.py:614:9: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:614:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:634:9: D400 [*] First line should end with a period
altair\utils\schemapi.py:744:5: D400 [*] First line should end with a period
altair\utils\schemapi.py:791:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:804:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:842:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:842:9: D400 [*] First line should end with a period
altair\utils\schemapi.py:959:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:959:9: D400 [*] First line should end with a period
altair\utils\schemapi.py:1059:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:1098:9: D400 [*] First line should end with a period
altair\utils\schemapi.py:1105:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:1105:9: D400 [*] First line should end with a period
altair\utils\schemapi.py:1138:9: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:1138:9: D400 [*] First line should end with a period
altair\utils\schemapi.py:1161:9: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:1188:9: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:1188:9: D400 [*] First line should end with a period
altair\utils\schemapi.py:1224:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\schemapi.py:1224:5: D400 [*] First line should end with a period
altair\utils\schemapi.py:1243:9: D205 1 blank line required between summary line and description
altair\utils\schemapi.py:1330:9: D400 [*] First line should end with a period
altair\utils\schemapi.py:1429:5: D200 [*] One-line docstring should fit on one line
altair\utils\selection.py:13:5: D205 1 blank line required between summary line and description
altair\utils\selection.py:58:5: D205 1 blank line required between summary line and description
altair\utils\selection.py:99:5: D205 1 blank line required between summary line and description
altair\utils\server.py:71:5: D400 [*] First line should end with a period
altair\utils\server.py:96:5: D400 [*] First line should end with a period
altair\utils\server.py:96:5: D213 [*] Multi-line docstring summary should start at the second line
altair\utils\theme.py:1:1: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:134:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:134:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:156:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:156:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:184:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:184:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:270:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:297:9: D300 [*] Use triple double quotes `"""`
altair\vegalite\v5\api.py:602:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:636:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:733:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:756:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:780:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:815:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:867:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:941:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:969:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1025:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1037:5: D205 1 blank line required between summary line and description
altair\vegalite\v5\api.py:1037:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1146:5: D202 [*] No blank lines allowed after function docstring (found 1)
altair\vegalite\v5\api.py:1183:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1183:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1295:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1398:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1404:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1410:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1416:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1422:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1428:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1434:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1478:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1478:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1513:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1538:9: D202 [*] No blank lines allowed after function docstring (found 1)
altair\vegalite\v5\api.py:1538:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1538:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1666:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1666:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1710:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1710:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1712:9: D410 [*] Missing blank line after section ("Parameters")
altair\vegalite\v5\api.py:1737:9: D411 [*] Missing blank line before section ("Returns")
altair\vegalite\v5\api.py:1760:9: D205 1 blank line required between summary line and description
altair\vegalite\v5\api.py:1760:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1779:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1807:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1807:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1925:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:1925:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:1976:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2024:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2146:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:2377:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2569:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2631:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2663:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2693:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2735:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2735:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:2788:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2834:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:2834:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:2885:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3093:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3093:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3207:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3207:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3303:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3316:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3358:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3418:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3506:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3506:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3544:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3544:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3588:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3588:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3629:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3629:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3666:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3726:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3789:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3789:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3812:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3812:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3851:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3851:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3872:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3898:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3898:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3922:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3922:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3962:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3967:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:3993:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:3993:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4017:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:4017:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4057:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4062:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4090:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:4090:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4114:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:4114:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4154:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4159:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4186:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:4186:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4229:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:4229:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4271:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4271:5: D403 [*] First word of the first line should be capitalized: `layer` -> `Layer`
altair\vegalite\v5\api.py:4276:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4296:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:4296:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4320:9: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:4320:9: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4357:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\api.py:4357:5: D400 [*] First line should end with a period
altair\vegalite\v5\api.py:4673:5: D205 1 blank line required between summary line and description
altair\vegalite\v5\api.py:4673:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\compiler.py:12:5: D200 [*] One-line docstring should fit on one line
altair\vegalite\v5\compiler.py:12:5: D400 [*] First line should end with a period
altair\vegalite\v5\display.py:92:5: D400 [*] First line should end with a period
altair\vegalite\v5\display.py:168:5: D213 [*] Multi-line docstring summary should start at the second line
altair\vegalite\v5\display.py:173:5: D407 [*] Missing dashed underline after section ("Parameters")
altair\vegalite\v5\theme.py:1:1: D400 [*] First line should end with a period
sphinxext\altairgallery.py:160:5: D400 [*] First line should end with a period
sphinxext\altairgallery.py:213:5: D202 [*] No blank lines allowed after function docstring (found 1)
sphinxext\altairgallery.py:213:5: D400 [*] First line should end with a period
sphinxext\schematable.py:16:5: D400 [*] First line should end with a period
sphinxext\schematable.py:47:5: D400 [*] First line should end with a period
sphinxext\schematable.py:70:5: D202 [*] No blank lines allowed after function docstring (found 1)
sphinxext\schematable.py:70:5: D400 [*] First line should end with a period
sphinxext\schematable.py:89:5: D400 [*] First line should end with a period
sphinxext\schematable.py:106:5: D202 [*] No blank lines allowed after function docstring (found 1)
sphinxext\schematable.py:106:5: D400 [*] First line should end with a period
sphinxext\schematable.py:153:5: D400 [*] First line should end with a period
sphinxext\schematable.py:166:5: D400 [*] First line should end with a period
sphinxext\utils.py:17:5: D400 [*] First line should end with a period
sphinxext\utils.py:40:5: D400 [*] First line should end with a period
sphinxext\utils.py:62:5: D213 [*] Multi-line docstring summary should start at the second line
sphinxext\utils.py:62:5: D400 [*] First line should end with a period
sphinxext\utils.py:91:5: D213 [*] Multi-line docstring summary should start at the second line
sphinxext\utils.py:91:5: D400 [*] First line should end with a period
sphinxext\utils.py:193:5: D400 [*] First line should end with a period
sphinxext\utils.py:200:5: D400 [*] First line should end with a period
tests\expr\test_expr.py:91:5: D400 [*] First line should end with a period
tests\expr\test_expr.py:91:5: D403 [*] First word of the first line should be capitalized: `test` -> `Test`
tests\expr\test_expr.py:99:5: D202 [*] No blank lines allowed after function docstring (found 1)
tests\expr\test_expr.py:99:5: D400 [*] First line should end with a period
tests\expr\test_expr.py:120:5: D400 [*] First line should end with a period
tests\test_examples.py:1:1: D213 [*] Multi-line docstring summary should start at the second line
tests\test_examples.py:1:1: D404 First word of the docstring should not be "This"
tests\test_examples.py:72:5: D213 [*] Multi-line docstring summary should start at the second line
tests\test_examples.py:108:5: D205 1 blank line required between summary line and description
tests\test_examples.py:108:5: D213 [*] Multi-line docstring summary should start at the second line
tests\utils\test_data.py:90:5: D205 1 blank line required between summary line and description
tests\utils\test_data.py:90:5: D213 [*] Multi-line docstring summary should start at the second line
tests\utils\test_data.py:90:5: D400 [*] First line should end with a period
tests\utils\test_data.py:108:5: D205 1 blank line required between summary line and description
tests\utils\test_data.py:108:5: D213 [*] Multi-line docstring summary should start at the second line
tests\utils\test_data.py:108:5: D400 [*] First line should end with a period
tests\utils\test_data.py:126:5: D205 1 blank line required between summary line and description
tests\utils\test_data.py:126:5: D213 [*] Multi-line docstring summary should start at the second line
tests\utils\test_data.py:126:5: D400 [*] First line should end with a period
tests\utils\test_data.py:144:5: D205 1 blank line required between summary line and description
tests\utils\test_data.py:144:5: D213 [*] Multi-line docstring summary should start at the second line
tests\utils\test_data.py:144:5: D400 [*] First line should end with a period
tests\utils\test_server.py:1:1: D200 [*] One-line docstring should fit on one line
tests\utils\test_server.py:1:1: D400 [*] First line should end with a period
tests\utils\test_to_values_narwhals.py:17:5: D400 [*] First line should end with a period
tests\utils\test_to_values_narwhals.py:34:5: D400 [*] First line should end with a period
tests\vegalite\test_common.py:1:1: D400 [*] First line should end with a period
tests\vegalite\v5\test_api.py:1:1: D400 [*] First line should end with a period
tests\vegalite\v5\test_api.py:412:5: D202 [*] No blank lines allowed after function docstring (found 1)
tests\vegalite\v5\test_api.py:437:5: D202 [*] No blank lines allowed after function docstring (found 1)
tests\vegalite\v5\test_api.py:486:5: D400 [*] First line should end with a period
tests\vegalite\v5\test_api.py:525:5: D213 [*] Multi-line docstring summary should start at the second line
tests\vegalite\v5\test_api.py:525:5: D400 [*] First line should end with a period
tests\vegalite\v5\test_api.py:578:5: D213 [*] Multi-line docstring summary should start at the second line
tests\vegalite\v5\test_api.py:578:5: D400 [*] First line should end with a period
tests\vegalite\v5\test_display.py:10:5: D400 [*] First line should end with a period
tests\vegalite\v5\test_display.py:10:5: D205 1 blank line required between summary line and description
tests\vegalite\v5\test_params.py:1:1: D400 [*] First line should end with a period
tests\vegalite\v5\test_renderers.py:1:1: D400 [*] First line should end with a period
tests\vegalite\v5\test_renderers.py:28:5: D400 [*] First line should end with a period
tests\vegalite\v5\test_renderers.py:64:5: D400 [*] First line should end with a period
tests\vegalite\v5\test_renderers.py:100:5: D400 [*] First line should end with a period
tools\generate_api_docs.py:1:1: D205 1 blank line required between summary line and description
tools\generate_api_docs.py:1:1: D404 First word of the docstring should not be "This"
tools\generate_schema_wrapper.py:1:1: D400 [*] First line should end with a period
tools\generate_schema_wrapper.py:406:5: D200 [*] One-line docstring should fit on one line
tools\generate_schema_wrapper.py:406:5: D400 [*] First line should end with a period
tools\generate_schema_wrapper.py:455:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\__init__.py:1:1: D200 [*] One-line docstring should fit on one line
tools\schemapi\__init__.py:1:1: D400 [*] First line should end with a period
tools\schemapi\codegen.py:1:1: D400 [*] First line should end with a period
tools\schemapi\codegen.py:19:5: D400 [*] First line should end with a period
tools\schemapi\codegen.py:38:5: D400 [*] First line should end with a period
tools\schemapi\codegen.py:86:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\codegen.py:86:5: D400 [*] First line should end with a period
tools\schemapi\codegen.py:162:9: D400 [*] First line should end with a period
tools\schemapi\codegen.py:240:9: D400 [*] First line should end with a period
tools\schemapi\codegen.py:383:9: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:131:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:131:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:165:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:165:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:212:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:212:5: D209 [*] Multi-line docstring closing quotes should be on a separate line
tools\schemapi\schemapi.py:212:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:224:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:277:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:277:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:277:5: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:294:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:294:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:309:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:309:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:329:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:329:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:353:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:353:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:392:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:392:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:408:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:408:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:430:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:430:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:430:5: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:458:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:458:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:510:5: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:510:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:532:5: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:612:9: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:612:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:632:9: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:742:5: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:789:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:802:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:840:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:840:9: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:957:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:957:9: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:1057:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:1096:9: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:1103:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:1103:9: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:1136:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:1136:9: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:1159:9: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:1186:9: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:1186:9: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:1222:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\schemapi.py:1222:5: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:1241:9: D205 1 blank line required between summary line and description
tools\schemapi\schemapi.py:1328:9: D400 [*] First line should end with a period
tools\schemapi\schemapi.py:1427:5: D200 [*] One-line docstring should fit on one line
tools\schemapi\utils.py:1:1: D400 [*] First line should end with a period
tools\schemapi\utils.py:32:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\utils.py:90:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\utils.py:117:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\utils.py:137:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\utils.py:146:9: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\utils.py:200:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\utils.py:200:5: D400 [*] First line should end with a period
tools\schemapi\utils.py:257:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\utils.py:257:5: D400 [*] First line should end with a period
tools\schemapi\utils.py:272:5: D400 [*] First line should end with a period
tools\schemapi\utils.py:316:5: D400 [*] First line should end with a period
tools\schemapi\utils.py:651:5: D400 [*] First line should end with a period
tools\schemapi\utils.py:744:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\utils.py:744:5: D400 [*] First line should end with a period
tools\schemapi\utils.py:775:5: D202 [*] No blank lines allowed after function docstring (found 1)
tools\schemapi\utils.py:775:5: D213 [*] Multi-line docstring summary should start at the second line
tools\schemapi\utils.py:793:5: D213 [*] Multi-line docstring summary should start at the second line
tools\update_init_file.py:1:1: D205 1 blank line required between summary line and description
tools\update_init_file.py:1:1: D404 First word of the docstring should not be "This"
tools\update_init_file.py:44:5: D205 1 blank line required between summary line and description
tools\update_init_file.py:44:5: D213 [*] Multi-line docstring summary should start at the second line
tools\update_init_file.py:82:5: D213 [*] Multi-line docstring summary should start at the second line
Found 472 errors.
[*] 410 fixable with the `--fix` option.

@dangotbanned
Copy link
Member Author

dangotbanned commented Jul 22, 2024

After further thought, the non-generated code provides a greater range of examples.

See #3493 (commits) for more variety.


One caveat is that docstring code formatting rules are not enabled yet - as they only affect non-generated code.

This part still applies, I'll probably leave that until there's another approval.
Unless @mattijn you think I should include that, for a simpler review process?

I thought there was more config to it, but it seems that it is just docstring-code-line-length

The default is "dynamic", which adjusts based on how indented the doc is.


Update

Just finished a very informal survey of projects listed in https://github.com/astral-sh/ruff?tab=readme-ov-file#whos-using-ruff

I planned to collect some data, but almost all the projects I looked into either used the default docstring-code-line-length or didn't enable docstring-code-format = true.

The following use the default:

  • airflow, pandas, polars, pytest

Ibis was the only one I found with it set.

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 88 # ibis

Copy link
Contributor

@binste binste left a comment

Choose a reason for hiding this comment

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

Configuration works for me as well. Thanks for setting it up and implementing the manual fixes! Adding my approval as well as a confirmation :)

@dangotbanned dangotbanned marked this pull request as ready for review July 22, 2024 18:51
@dangotbanned
Copy link
Member Author

Thanks @binste @mattijn for the approvals, apologies that I'm asking for another

If anyone has any strong opinions on the change in 4ccad22 (#3493)

My suggestion would be to revisit during the review of

That will end up with more docstring code block examples once finished.
I personally don't mind either style. Maybe leaning towards the 88 one to account for long class names?

@mattijn mattijn merged commit f2ac0a1 into vega:main Jul 22, 2024
11 checks passed
dangotbanned added a commit to dangotbanned/altair that referenced this pull request Jul 23, 2024
I left this as a TODO during vega#3493 and only spotted it after merging
@dangotbanned dangotbanned deleted the ruff-docs-rules branch July 24, 2024 08:48
binste pushed a commit that referenced this pull request Jul 25, 2024
I left this as a TODO during #3493 and only spotted it after merging
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.

4 participants