mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 02:12:22 +00:00
Avoid D100
for Jupyter Notebooks (#8816)
This PR avoids triggering `D100` for Jupyter Notebooks. Part of #8669
This commit is contained in:
parent
63a87dda63
commit
0cb438dd65
4 changed files with 51 additions and 0 deletions
43
crates/ruff_linter/resources/test/fixtures/pydocstyle/D100.ipynb
vendored
Normal file
43
crates/ruff_linter/resources/test/fixtures/pydocstyle/D100.ipynb
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "33faf7ad-a3fd-4ac4-a0c3-52e507ed49df",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Hello world!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(\"Hello world!\")"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python (ruff-playground)",
|
||||
"language": "python",
|
||||
"name": "ruff-playground"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
|
@ -62,6 +62,7 @@ mod tests {
|
|||
#[test_case(Rule::UndocumentedPublicMethod, Path::new("D.py"))]
|
||||
#[test_case(Rule::UndocumentedPublicMethod, Path::new("setter.py"))]
|
||||
#[test_case(Rule::UndocumentedPublicModule, Path::new("D.py"))]
|
||||
#[test_case(Rule::UndocumentedPublicModule, Path::new("D100.ipynb"))]
|
||||
#[test_case(
|
||||
Rule::UndocumentedPublicModule,
|
||||
Path::new("_unrelated/pkg/D100_pub.py")
|
||||
|
|
|
@ -534,6 +534,9 @@ pub(crate) fn not_missing(
|
|||
kind: ModuleKind::Module,
|
||||
..
|
||||
}) => {
|
||||
if checker.source_type.is_ipynb() {
|
||||
return true;
|
||||
}
|
||||
if checker.enabled(Rule::UndocumentedPublicModule) {
|
||||
checker.diagnostics.push(Diagnostic::new(
|
||||
UndocumentedPublicModule,
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
|
||||
---
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue