-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
crates/ruff_linter/src/rules/pydoclint/rules/check_docstring.rs
Outdated
Show resolved
Hide resolved
@@ -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) { |
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.
Could we use strip_prefix
here with the indentation instead of using chars
?
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.
Ok I reimplemented using strip_prefix
but I still needed to call chars
to check if the first char is_whitepace
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.
Makes sense!
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.
Thx!
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