-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[WIP] docs: Fix broken :refs: and other api issues
#15766
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/usr/bin/python3 | ||
|
|
||
| import subprocess | ||
| import sys | ||
|
|
||
| # TODO(phlax): add rstcheck also | ||
|
|
||
| # things we dont want to see in generated docs | ||
| # TODO(phlax): move to .rstcheck.cfg when available | ||
| RSTCHECK_GREP_FAIL = (" ref:", "\\[\\#") | ||
|
|
||
|
|
||
| def run_grep_check(check): | ||
|
||
| command = ["grep", "-nr", "--include", "\\*.rst"] + [check] | ||
|
||
| resp = subprocess.run(command, capture_output=True, cwd=sys.argv[1]) | ||
|
|
||
| # this fails if returncode is 0 - ie it should not have any matches | ||
| if not resp.returncode: | ||
| # stdout and stderr are dumped to ensure we capture all errors | ||
| sys.stderr.write( | ||
| f"ERROR: rstcheck linting failed, found unwanted: '{check}'\n" | ||
| f"{resp.stdout.decode('utf-8')}\n" | ||
|
||
| f"{resp.stderr.decode('utf-8')}") | ||
| return len(resp.stdout.decode("utf-8").split("\n")) - 1 | ||
|
|
||
|
|
||
| def main(): | ||
| errors = 0 | ||
| for check in RSTCHECK_GREP_FAIL: | ||
| errors += run_grep_check(check) | ||
| if errors: | ||
| raise SystemExit(f"RST check failed: {errors} errors") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have another WiP PR here; a bit confused..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the point was to move it there once that PR landed
i wanted to land this because it fixes actual problems, and then add a better solution in the follow up #15786
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you let me know when the Python is ready for final review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/wait