-
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
Ignore DOC
errors for stub functions
#12651
Conversation
DOC
errors for stub functions
d5b3504
to
9eb597e
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
DOC202 | 10 | 0 | 10 | 0 | 0 |
return; | ||
}; | ||
|
||
// Only check function docstrings. | ||
if matches!( |
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.
Is this check now covered by is_stub?
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.
It's covered by the
let Some(function_def) = definition.as_function_def() else {
return;
};
immediately above
if let Some(body_return) = body_entries.returns.first() { | ||
let diagnostic = Diagnostic::new(DocstringMissingReturns, body_return.range()); | ||
diagnostics.push(diagnostic); | ||
if checker.enabled(Rule::DocstringMissingReturns) { |
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.
Is this change just a stylistic preference?
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.
Yeah, I prefer to have the enablement checks separated out from any lint-specific checks. I find it to be a clearer separation, and it would make it easier to identify and automatically rewrite them in the future.
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, thanks
Summary
Closes #12650.