-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[pydoclint
] Fix false positive when Sphinx directives follow Raises section (DOC502
)
#20535
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
base: main
Are you sure you want to change the base?
Conversation
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
DOC502 | 26 | 8 | 18 | 0 | 0 |
Note on
Net effect is reduced noise and improved precision |
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.
Thanks! I had an idea for a possibly simpler implementation more similar to the numpy version. Let me know what you think. We should keep a close eye on the ecosystem results to make sure they are still improved.
This new result actually looks incorrect to me:
- libs/langchain_v1/langchain/agents/react_agent.py:304:9: DOC502 Raised exception is not explicitly raised:
MultipleStructuredOutputsError
Maybe my suggestion will help with that too.
}; | ||
let entry = potential[..colon_idx].trim(); | ||
entries.push(QualifiedName::user_defined(entry)); | ||
|
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.
What do you think about something more like this for this function?
fn parse_entries_google(content: &str) -> Vec<QualifiedName<'_>> {
let mut entries: Vec<QualifiedName> = Vec::new();
let mut lines = content.lines().peekable();
let Some(first) = lines.peek() else {
return entries;
};
let indentation = &first[..first.len() - first.trim_start().len()];
for potential in lines {
if let Some(entry) = potential.strip_prefix(indentation) {
if let Some(first_char) = entry.chars().next() {
if !first_char.is_whitespace() {
if let Some(colon_idx) = entry.find(':') {
let entry = entry[..colon_idx].trim();
if !entry.is_empty() {
entries.push(QualifiedName::user_defined(entry));
}
}
}
}
}
}
entries
}
This is closer to the parse_entries_numpy
down below and seems to work on the new test case when I tried it locally.
Summary
Fixes #18959