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

[pydoclint] Fix DOC501 panic #12428 #12435

Merged
merged 4 commits into from
Jul 21, 2024
Merged

Conversation

augustelalande
Copy link
Contributor

@augustelalande augustelalande commented Jul 21, 2024

Summary

Fix panic reported in #12428. Where a string would sometimes get split within a character boundary. This bypasses the need to split the string.

This does not guarantee the correct formatting of the docstring, but neither did the previous implementation.

Resolves #12428

Test Plan

Test case added to fixture

@@ -210,7 +210,7 @@ fn parse_entries_numpy(content: &str) -> Vec<QualifiedName> {
for potential in split {
if let Some(first_char) = potential.chars().nth(indentation) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we use strip_prefix here with the indentation instead of using chars?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I reimplemented using strip_prefix but I still needed to call chars to check if the first char is_whitepace

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense!

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Thx!

@charliermarsh charliermarsh added bug Something isn't working fuzzer Surfaced via fuzzing. labels Jul 21, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) July 21, 2024 19:26
@charliermarsh charliermarsh merged commit 3a742c1 into astral-sh:main Jul 21, 2024
19 checks passed
@augustelalande augustelalande deleted the doc501 branch July 21, 2024 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fuzzer Surfaced via fuzzing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Checking file with rule DOC501 cause panic
2 participants