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

Ignore DOC errors for stub functions #12651

Merged
merged 1 commit into from
Aug 3, 2024
Merged

Ignore DOC errors for stub functions #12651

merged 1 commit into from
Aug 3, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Closes #12650.

@charliermarsh charliermarsh changed the title Ignore DOC errors for stub functions Ignore DOC errors for stub functions Aug 3, 2024
@charliermarsh charliermarsh added the docstring Related to docstring linting or formatting label Aug 3, 2024
Copy link
Contributor

github-actions bot commented Aug 3, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -10 violations, +0 -0 fixes in 1 projects; 53 projects unchanged)

bokeh/bokeh (+0 -10 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

- src/bokeh/application/application.py:344:1: DOC202 Docstring should not have a returns section because the function doesn't return anything
- src/bokeh/application/handlers/handler.py:137:1: DOC202 Docstring should not have a returns section because the function doesn't return anything
- src/bokeh/application/handlers/lifecycle.py:75:1: DOC202 Docstring should not have a returns section because the function doesn't return anything
- src/bokeh/colors/color.py:124:1: DOC202 Docstring should not have a returns section because the function doesn't return anything
- src/bokeh/colors/color.py:141:1: DOC202 Docstring should not have a returns section because the function doesn't return anything
- src/bokeh/colors/color.py:175:1: DOC202 Docstring should not have a returns section because the function doesn't return anything
- src/bokeh/colors/color.py:187:1: DOC202 Docstring should not have a returns section because the function doesn't return anything
- src/bokeh/colors/color.py:199:1: DOC202 Docstring should not have a returns section because the function doesn't return anything
- src/bokeh/core/property/bases.py:306:1: DOC202 Docstring should not have a returns section because the function doesn't return anything
- src/bokeh/core/property/descriptor_factory.py:124:1: DOC202 Docstring should not have a returns section because the function doesn't return anything

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
DOC202 10 0 10 0 0

return;
};

// Only check function docstrings.
if matches!(
Copy link
Member

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?

Copy link
Member

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) {
Copy link
Member

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?

Copy link
Member Author

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.

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, thanks

@charliermarsh charliermarsh merged commit 733341a into main Aug 3, 2024
20 checks passed
@charliermarsh charliermarsh deleted the charlie/DOC branch August 3, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docstring Related to docstring linting or formatting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC202 false positive when function doesn't return
3 participants