Skip to content

DOC: Uniform block directive syntax. #44757

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

Merged
merged 1 commit into from
Dec 5, 2021
Merged

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Dec 4, 2021

block directive syntax technically does not have space before the
double-colon.

While this seem to be accepted by docutils – but not documented,
this can throw off other RST parser/syntax highlighter.
Sometime they can see that as comments, sometime they give garbage out.

Plus this is really uncommon with 3 occurrences in pandas codebase with
space and 4800 without:

pandas[master]  $ rg '\.\. \w+::' | wc -l
4853

Numpy and scipy used to have a few space in their block directive, but
current master/main branch of both should also be free of directive with
space before the double colon.


  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

Note that this issue can be seen in the syntax highlighting of the diff of this PR itself, where the deleted lines are gray (comment), and added ones are blue/purple (directives)

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

nice

could u add as a doc check rule as well (can be a follow up)

@jreback
Copy link
Contributor

jreback commented Dec 4, 2021

cc @MarcoGorelli

@Carreau
Copy link
Contributor Author

Carreau commented Dec 4, 2021

could u add as a doc check rule as well (can be a follow up)

Yeah, I'm unsure how to currently check for that. I detected it automatically but the project that made me discover that is way too far from prime time to be added as a check. I could just grep for it and check the status code, but I'm afraid it would be a bit brittle.

@MarcoGorelli
Copy link
Member

Could you add it as a pygrep check to the precommit config file?

@lithomas1 lithomas1 added Code Style Code style, linting, code_checks Docs labels Dec 4, 2021
block directive syntax technically does not have space before the
double-colon.

While this seem to be accepted by docutils – but not documented,
this can throw off other RST parser/syntax highlighter.
Sometime they can see that as comments, sometime they give garbage out.

Plus this is really uncommon with 3 occurrences in pandas codebase with
space and 4800 without:

    pandas[master]  $ rg '\.\. \w+::' | wc -l
    4853

Numpy and scipy used to have a few space in their block directive, but
current master/main branch of both should also be free of directive with
space before the double colon.
@Carreau
Copy link
Contributor Author

Carreau commented Dec 4, 2021

Done.

@jreback jreback added this to the 1.4 milestone Dec 4, 2021
@jreback
Copy link
Contributor

jreback commented Dec 4, 2021

lgtm. cc @MarcoGorelli

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

Looks good to me (CI docs/web failure looks unrelated, should that be fixed before merging this?)

@jreback jreback merged commit 9c74428 into pandas-dev:master Dec 5, 2021
@jreback
Copy link
Contributor

jreback commented Dec 5, 2021

thanks @Carreau

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants