Skip to content

DOC: update validate_docstrings.py Validation script checks for tabs #20112

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
Mar 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/validate_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,12 @@ def validate_one(func_name):
if not rel_desc:
errs.append('Missing description for '
'See Also "{}" reference'.format(rel_name))

for line in doc.raw_doc.splitlines():
if re.match("^ *\t", line):
Copy link
Contributor

Choose a reason for hiding this comment

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

'\t' in line is good enough, yes? we don't all any tabs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you see the comments above @TomAugspurger requested "Starts with tab" as there might be tabs to format a table or the like I think

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, not sure this is actually strict enough. as I said we don't allow any tabs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to change it back to allow no tabs at all. Let me know what you think @TomAugspurger

Copy link
Member

Choose a reason for hiding this comment

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

@jreback There are cases where a \t is included in the text as literal character (for the explanation).
So I think only checking the start of a line is good.

Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to where \t is included, we could use re.search(r'^ *\t', self.raw_doc, flags=re.MULTILINE) and avoid the loop

Copy link
Member

Choose a reason for hiding this comment

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

ups, sorry, I see now that you want to report the lines with the tabs...

errs.append('Tabs found at the start of line "{}", '
'please use whitespace only'.format(line.lstrip()))

examples_errs = ''
if not doc.examples:
errs.append('No examples section found')
Expand Down