Add applicability to pydocstyle (#5390)

This commit is contained in:
Evan Rittenhouse 2023-06-27 11:40:19 -05:00 committed by GitHub
parent 0585e14d3b
commit ff0d0ab7a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 125 additions and 156 deletions

View file

@ -75,8 +75,7 @@ pub(crate) fn blank_after_summary(checker: &mut Checker, docstring: &Docstring)
}
// Insert one blank line after the summary (replacing any existing lines).
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::replacement(
diagnostic.set_fix(Fix::automatic(Edit::replacement(
checker.stylist.line_ending().to_string(),
summary_end,
blank_end,

View file

@ -97,8 +97,7 @@ pub(crate) fn blank_before_after_class(checker: &mut Checker, docstring: &Docstr
);
if checker.patch(diagnostic.kind.rule()) {
// Delete the blank line before the class.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::deletion(
diagnostic.set_fix(Fix::automatic(Edit::deletion(
blank_lines_start,
docstring.start() - docstring.indentation.text_len(),
)));
@ -116,8 +115,7 @@ pub(crate) fn blank_before_after_class(checker: &mut Checker, docstring: &Docstr
);
if checker.patch(diagnostic.kind.rule()) {
// Insert one blank line before the class.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::replacement(
diagnostic.set_fix(Fix::automatic(Edit::replacement(
checker.stylist.line_ending().to_string(),
blank_lines_start,
docstring.start() - docstring.indentation.text_len(),
@ -163,8 +161,7 @@ pub(crate) fn blank_before_after_class(checker: &mut Checker, docstring: &Docstr
);
if checker.patch(diagnostic.kind.rule()) {
// Insert a blank line before the class (replacing any existing lines).
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::replacement(
diagnostic.set_fix(Fix::automatic(Edit::replacement(
checker.stylist.line_ending().to_string(),
first_line_start,
blank_lines_end,

View file

@ -86,8 +86,7 @@ pub(crate) fn blank_before_after_function(checker: &mut Checker, docstring: &Doc
);
if checker.patch(diagnostic.kind.rule()) {
// Delete the blank line before the docstring.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::deletion(
diagnostic.set_fix(Fix::automatic(Edit::deletion(
blank_lines_start,
docstring.start() - docstring.indentation.text_len(),
)));
@ -143,8 +142,7 @@ pub(crate) fn blank_before_after_function(checker: &mut Checker, docstring: &Doc
);
if checker.patch(diagnostic.kind.rule()) {
// Delete the blank line after the docstring.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::deletion(
diagnostic.set_fix(Fix::automatic(Edit::deletion(
first_line_end,
blank_lines_end,
)));

View file

@ -76,8 +76,7 @@ pub(crate) fn capitalized(checker: &mut Checker, docstring: &Docstring) {
);
if checker.patch(diagnostic.kind.rule()) {
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::automatic(Edit::range_replacement(
capitalized_word,
TextRange::at(body.start(), first_word.text_len()),
)));

View file

@ -64,8 +64,7 @@ pub(crate) fn ends_with_period(checker: &mut Checker, docstring: &Docstring) {
&& !trimmed.ends_with(':')
&& !trimmed.ends_with(';')
{
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
diagnostic.set_fix(Fix::suggested(Edit::insertion(
".".to_string(),
line.start() + trimmed.text_len(),
)));

View file

@ -61,8 +61,7 @@ pub(crate) fn ends_with_punctuation(checker: &mut Checker, docstring: &Docstring
let mut diagnostic = Diagnostic::new(EndsInPunctuation, docstring.range());
// Best-effort autofix: avoid adding a period after other punctuation marks.
if checker.patch(diagnostic.kind.rule()) && !trimmed.ends_with([':', ';']) {
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
diagnostic.set_fix(Fix::suggested(Edit::insertion(
".".to_string(),
line.start() + trimmed.text_len(),
)));

View file

@ -91,8 +91,7 @@ pub(crate) fn indent(checker: &mut Checker, docstring: &Docstring) {
let mut diagnostic =
Diagnostic::new(UnderIndentation, TextRange::empty(line.start()));
if checker.patch(diagnostic.kind.rule()) {
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::automatic(Edit::range_replacement(
clean_space(docstring.indentation),
TextRange::at(line.start(), line_indent.text_len()),
)));
@ -139,8 +138,7 @@ pub(crate) fn indent(checker: &mut Checker, docstring: &Docstring) {
} else {
Edit::range_replacement(indent, over_indented)
};
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(edit));
diagnostic.set_fix(Fix::automatic(edit));
}
checker.diagnostics.push(diagnostic);
}
@ -160,8 +158,7 @@ pub(crate) fn indent(checker: &mut Checker, docstring: &Docstring) {
} else {
Edit::range_replacement(indent, range)
};
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(edit));
diagnostic.set_fix(Fix::automatic(edit));
}
checker.diagnostics.push(diagnostic);
}

View file

@ -66,8 +66,7 @@ pub(crate) fn multi_line_summary_start(checker: &mut Checker, docstring: &Docstr
// Delete until first non-whitespace char.
for line in content_lines {
if let Some(end_column) = line.find(|c: char| !c.is_whitespace()) {
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::deletion(
diagnostic.set_fix(Fix::automatic(Edit::deletion(
first_line.end(),
line.start() + TextSize::try_from(end_column).unwrap(),
)));
@ -114,8 +113,7 @@ pub(crate) fn multi_line_summary_start(checker: &mut Checker, docstring: &Docstr
first_line.strip_prefix(prefix).unwrap().trim_start()
);
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::replacement(
diagnostic.set_fix(Fix::automatic(Edit::replacement(
repl,
body.start(),
first_line.end(),

View file

@ -58,8 +58,7 @@ pub(crate) fn newline_after_last_paragraph(checker: &mut Checker, docstring: &Do
checker.stylist.line_ending().as_str(),
clean_space(docstring.indentation)
);
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::replacement(
diagnostic.set_fix(Fix::automatic(Edit::replacement(
content,
docstring.expr.end() - num_trailing_quotes - num_trailing_spaces,
docstring.expr.end() - num_trailing_quotes,

View file

@ -47,8 +47,7 @@ pub(crate) fn no_surrounding_whitespace(checker: &mut Checker, docstring: &Docst
// characters, avoid applying the fix.
if !trimmed.ends_with(quote) && !trimmed.starts_with(quote) && !ends_with_backslash(trimmed)
{
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::automatic(Edit::range_replacement(
trimmed.to_string(),
TextRange::at(body.start(), line.text_len()),
)));

View file

@ -51,8 +51,7 @@ pub(crate) fn one_liner(checker: &mut Checker, docstring: &Docstring) {
if !trimmed.ends_with(trailing.chars().last().unwrap())
&& !trimmed.starts_with(leading.chars().last().unwrap())
{
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::suggested(Edit::range_replacement(
format!("{leading}{trimmed}{trailing}"),
docstring.range(),
)));

View file

@ -376,8 +376,7 @@ fn blanks_and_section_underline(
let range =
TextRange::new(context.following_range().start(), blank_lines_end);
// Delete any blank lines between the header and the underline.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_deletion(range)));
diagnostic.set_fix(Fix::automatic(Edit::range_deletion(range)));
}
checker.diagnostics.push(diagnostic);
}
@ -405,8 +404,7 @@ fn blanks_and_section_underline(
"-".repeat(context.section_name().len()),
checker.stylist.line_ending().as_str()
);
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::replacement(
diagnostic.set_fix(Fix::automatic(Edit::replacement(
content,
blank_lines_end,
non_blank_line.full_end(),
@ -432,8 +430,7 @@ fn blanks_and_section_underline(
);
// Replace the existing indentation with whitespace of the appropriate length.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::automatic(Edit::range_replacement(
clean_space(docstring.indentation),
range,
)));
@ -472,8 +469,7 @@ fn blanks_and_section_underline(
);
if checker.patch(diagnostic.kind.rule()) {
// Delete any blank lines between the header and content.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::deletion(
diagnostic.set_fix(Fix::automatic(Edit::deletion(
line_after_dashes.start(),
blank_lines_after_dashes_end,
)));
@ -507,8 +503,7 @@ fn blanks_and_section_underline(
clean_space(docstring.indentation),
"-".repeat(context.section_name().len()),
);
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
diagnostic.set_fix(Fix::automatic(Edit::insertion(
content,
context.summary_range().end(),
)));
@ -527,8 +522,7 @@ fn blanks_and_section_underline(
let range =
TextRange::new(context.following_range().start(), blank_lines_end);
// Delete any blank lines between the header and content.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_deletion(range)));
diagnostic.set_fix(Fix::automatic(Edit::range_deletion(range)));
}
checker.diagnostics.push(diagnostic);
}
@ -553,8 +547,7 @@ fn blanks_and_section_underline(
"-".repeat(context.section_name().len()),
);
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
diagnostic.set_fix(Fix::automatic(Edit::insertion(
content,
context.summary_range().end(),
)));
@ -591,8 +584,7 @@ fn common_section(
// Replace the section title with the capitalized variant. This requires
// locating the start and end of the section name.
let section_range = context.section_name_range();
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::automatic(Edit::range_replacement(
capitalized_section_name.to_string(),
section_range,
)));
@ -615,8 +607,7 @@ fn common_section(
let content = clean_space(docstring.indentation);
let fix_range = TextRange::at(context.range().start(), leading_space.text_len());
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(if content.is_empty() {
diagnostic.set_fix(Fix::automatic(if content.is_empty() {
Edit::range_deletion(fix_range)
} else {
Edit::range_replacement(content, fix_range)
@ -639,8 +630,7 @@ fn common_section(
);
if checker.patch(diagnostic.kind.rule()) {
// Add a newline at the beginning of the next section.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
diagnostic.set_fix(Fix::automatic(Edit::insertion(
line_end.to_string(),
next.range().start(),
)));
@ -657,8 +647,7 @@ fn common_section(
);
if checker.patch(diagnostic.kind.rule()) {
// Add a newline after the section.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
diagnostic.set_fix(Fix::automatic(Edit::insertion(
format!("{}{}", line_end, docstring.indentation),
context.range().end(),
)));
@ -678,8 +667,7 @@ fn common_section(
);
if checker.patch(diagnostic.kind.rule()) {
// Add a blank line before the section.
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::insertion(
diagnostic.set_fix(Fix::automatic(Edit::insertion(
line_end.to_string(),
context.range().start(),
)));
@ -882,8 +870,7 @@ fn numpy_section(
);
if checker.patch(diagnostic.kind.rule()) {
let section_range = context.section_name_range();
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_deletion(TextRange::at(
diagnostic.set_fix(Fix::automatic(Edit::range_deletion(TextRange::at(
section_range.end(),
suffix.text_len(),
))));
@ -920,8 +907,7 @@ fn google_section(
if checker.patch(diagnostic.kind.rule()) {
// Replace the suffix.
let section_name_range = context.section_name_range();
#[allow(deprecated)]
diagnostic.set_fix(Fix::unspecified(Edit::range_replacement(
diagnostic.set_fix(Fix::automatic(Edit::range_replacement(
":".to_string(),
TextRange::at(section_name_range.end(), suffix.text_len()),
)));

View file

@ -10,7 +10,7 @@ D.py:137:5: D201 [*] No blank lines allowed before function docstring (found 1)
|
= help: Remove blank line(s) before function docstring
Suggested fix
Fix
133 133 |
134 134 | @expect('D201: No blank lines allowed before function docstring (found 1)')
135 135 | def leading_space():
@ -30,7 +30,7 @@ D.py:151:5: D201 [*] No blank lines allowed before function docstring (found 1)
|
= help: Remove blank line(s) before function docstring
Suggested fix
Fix
147 147 | @expect('D201: No blank lines allowed before function docstring (found 1)')
148 148 | @expect('D202: No blank lines allowed after function docstring (found 1)')
149 149 | def trailing_and_leading_space():
@ -52,7 +52,7 @@ D.py:546:5: D201 [*] No blank lines allowed before function docstring (found 1)
|
= help: Remove blank line(s) before function docstring
Suggested fix
Fix
542 542 | @expect('D201: No blank lines allowed before function docstring (found 1)')
543 543 | @expect('D213: Multi-line docstring summary should start at the second line')
544 544 | def multiline_leading_space():
@ -76,7 +76,7 @@ D.py:568:5: D201 [*] No blank lines allowed before function docstring (found 1)
|
= help: Remove blank line(s) before function docstring
Suggested fix
Fix
564 564 | @expect('D202: No blank lines allowed after function docstring (found 1)')
565 565 | @expect('D213: Multi-line docstring summary should start at the second line')
566 566 | def multiline_trailing_and_leading_space():

View file

@ -12,7 +12,7 @@ D.py:142:5: D202 [*] No blank lines allowed after function docstring (found 1)
|
= help: Remove blank line(s) after function docstring
Suggested fix
Fix
140 140 | @expect('D202: No blank lines allowed after function docstring (found 1)')
141 141 | def trailing_space():
142 142 | """Leading space."""
@ -32,7 +32,7 @@ D.py:151:5: D202 [*] No blank lines allowed after function docstring (found 1)
|
= help: Remove blank line(s) after function docstring
Suggested fix
Fix
149 149 | def trailing_and_leading_space():
150 150 |
151 151 | """Trailing and leading space."""
@ -56,7 +56,7 @@ D.py:555:5: D202 [*] No blank lines allowed after function docstring (found 1)
|
= help: Remove blank line(s) after function docstring
Suggested fix
Fix
556 556 |
557 557 | More content.
558 558 | """
@ -80,7 +80,7 @@ D.py:568:5: D202 [*] No blank lines allowed after function docstring (found 1)
|
= help: Remove blank line(s) after function docstring
Suggested fix
Fix
569 569 |
570 570 | More content.
571 571 | """

View file

@ -10,7 +10,7 @@ D202.py:57:5: D202 [*] No blank lines allowed after function docstring (found 2)
|
= help: Remove blank line(s) after function docstring
Suggested fix
Fix
55 55 | # D202
56 56 | def outer():
57 57 | """This is a docstring."""
@ -29,7 +29,7 @@ D202.py:68:5: D202 [*] No blank lines allowed after function docstring (found 2)
|
= help: Remove blank line(s) after function docstring
Suggested fix
Fix
66 66 | # D202
67 67 | def outer():
68 68 | """This is a docstring."""
@ -50,7 +50,7 @@ D202.py:80:5: D202 [*] No blank lines allowed after function docstring (found 1)
|
= help: Remove blank line(s) after function docstring
Suggested fix
Fix
78 78 | # D202
79 79 | def outer():
80 80 | """This is a docstring."""

View file

@ -9,7 +9,7 @@ D.py:161:5: D203 [*] 1 blank line required before class docstring
|
= help: Insert 1 blank line before class docstring
Suggested fix
Fix
158 158 |
159 159 |
160 160 | class LeadingSpaceMissing:
@ -27,7 +27,7 @@ D.py:192:5: D203 [*] 1 blank line required before class docstring
|
= help: Insert 1 blank line before class docstring
Suggested fix
Fix
189 189 |
190 190 |
191 191 | class LeadingAndTrailingSpaceMissing:
@ -54,7 +54,7 @@ D.py:526:5: D203 [*] 1 blank line required before class docstring
|
= help: Insert 1 blank line before class docstring
Suggested fix
Fix
523 523 | # This is reproducing a bug where AttributeError is raised when parsing class
524 524 | # parameters as functions for Google / Numpy conventions.
525 525 | class Blah: # noqa: D203,D213

View file

@ -11,7 +11,7 @@ D.py:181:5: D204 [*] 1 blank line required after class docstring
|
= help: Insert 1 blank line after class docstring
Suggested fix
Fix
179 179 | class TrailingSpace:
180 180 |
181 181 | """TrailingSpace."""
@ -29,7 +29,7 @@ D.py:192:5: D204 [*] 1 blank line required after class docstring
|
= help: Insert 1 blank line after class docstring
Suggested fix
Fix
190 190 |
191 191 | class LeadingAndTrailingSpaceMissing:
192 192 | """Leading and trailing space missing."""

View file

@ -29,7 +29,7 @@ D.py:210:5: D205 [*] 1 blank line required between summary line and description
|
= help: Insert single blank line
Suggested fix
Fix
209 209 | def multi_line_two_separating_blanks():
210 210 | """Summary.
211 211 |

View file

@ -12,7 +12,7 @@ D.py:232:1: D207 [*] Docstring is under-indented
|
= help: Increase indentation
Suggested fix
Fix
229 229 | def asdfsdf():
230 230 | """Summary.
231 231 |
@ -31,7 +31,7 @@ D.py:244:1: D207 [*] Docstring is under-indented
|
= help: Increase indentation
Suggested fix
Fix
241 241 |
242 242 | Description.
243 243 |
@ -51,7 +51,7 @@ D.py:440:1: D207 [*] Docstring is under-indented
|
= help: Increase indentation
Suggested fix
Fix
437 437 | @expect('D213: Multi-line docstring summary should start at the second line')
438 438 | def docstring_start_in_same_line(): """First Line.
439 439 |
@ -69,7 +69,7 @@ D.py:441:1: D207 [*] Docstring is under-indented
|
= help: Increase indentation
Suggested fix
Fix
438 438 | def docstring_start_in_same_line(): """First Line.
439 439 |
440 440 | Second Line

View file

@ -12,7 +12,7 @@ D.py:252:1: D208 [*] Docstring is over-indented
|
= help: Remove over-indentation
Suggested fix
Fix
249 249 | def asdfsdsdf24():
250 250 | """Summary.
251 251 |
@ -31,7 +31,7 @@ D.py:264:1: D208 [*] Docstring is over-indented
|
= help: Remove over-indentation
Suggested fix
Fix
261 261 |
262 262 | Description.
263 263 |
@ -52,7 +52,7 @@ D.py:272:1: D208 [*] Docstring is over-indented
|
= help: Remove over-indentation
Suggested fix
Fix
269 269 | def asdfsdfsdsdsdfsdf24():
270 270 | """Summary.
271 271 |

View file

@ -13,7 +13,7 @@ D.py:281:5: D209 [*] Multi-line docstring closing quotes should be on a separate
|
= help: Move closing quotes to new line
Suggested fix
Fix
280 280 | def asdfljdf24():
281 281 | """Summary.
282 282 |
@ -36,7 +36,7 @@ D.py:588:5: D209 [*] Multi-line docstring closing quotes should be on a separate
|
= help: Move closing quotes to new line
Suggested fix
Fix
587 587 | def asdfljdjgf24():
588 588 | """Summary.
589 589 |

View file

@ -10,7 +10,7 @@ D.py:288:5: D210 [*] No whitespaces allowed surrounding docstring text
|
= help: Trim surrounding whitespace
Suggested fix
Fix
285 285 |
286 286 | @expect('D210: No whitespaces allowed surrounding docstring text')
287 287 | def endswith():
@ -29,7 +29,7 @@ D.py:293:5: D210 [*] No whitespaces allowed surrounding docstring text
|
= help: Trim surrounding whitespace
Suggested fix
Fix
290 290 |
291 291 | @expect('D210: No whitespaces allowed surrounding docstring text')
292 292 | def around():
@ -52,7 +52,7 @@ D.py:299:5: D210 [*] No whitespaces allowed surrounding docstring text
|
= help: Trim surrounding whitespace
Suggested fix
Fix
296 296 | @expect('D210: No whitespaces allowed surrounding docstring text')
297 297 | @expect('D213: Multi-line docstring summary should start at the second line')
298 298 | def multiline():

View file

@ -10,7 +10,7 @@ D.py:170:5: D211 [*] No blank lines allowed before class docstring
|
= help: Remove blank line(s) before class docstring
Suggested fix
Fix
166 166 |
167 167 |
168 168 | class WithLeadingSpace:
@ -29,7 +29,7 @@ D.py:181:5: D211 [*] No blank lines allowed before class docstring
|
= help: Remove blank line(s) before class docstring
Suggested fix
Fix
177 177 |
178 178 |
179 179 | class TrailingSpace:

View file

@ -13,7 +13,7 @@ D.py:129:5: D212 [*] Multi-line docstring summary should start at the first line
|
= help: Remove whitespace after opening quotes
Suggested fix
Fix
126 126 | '(found 3)')
127 127 | @expect('D212: Multi-line docstring summary should start at the first line')
128 128 | def asdlkfasd():
@ -36,7 +36,7 @@ D.py:597:5: D212 [*] Multi-line docstring summary should start at the first line
|
= help: Remove whitespace after opening quotes
Suggested fix
Fix
594 594 | '(found 3)')
595 595 | @expect('D212: Multi-line docstring summary should start at the first line')
596 596 | def one_liner():
@ -60,7 +60,7 @@ D.py:624:5: D212 [*] Multi-line docstring summary should start at the first line
|
= help: Remove whitespace after opening quotes
Suggested fix
Fix
621 621 | '(found 3)')
622 622 | @expect('D212: Multi-line docstring summary should start at the first line')
623 623 | def one_liner():

View file

@ -14,7 +14,7 @@ D.py:200:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
197 197 | '(found 0)')
198 198 | @expect('D213: Multi-line docstring summary should start at the second line')
199 199 | def multi_line_zero_separating_blanks():
@ -40,7 +40,7 @@ D.py:210:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
207 207 | '(found 2)')
208 208 | @expect('D213: Multi-line docstring summary should start at the second line')
209 209 | def multi_line_two_separating_blanks():
@ -65,7 +65,7 @@ D.py:220:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
217 217 |
218 218 | @expect('D213: Multi-line docstring summary should start at the second line')
219 219 | def multi_line_one_separating_blanks():
@ -90,7 +90,7 @@ D.py:230:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
227 227 | @expect('D207: Docstring is under-indented')
228 228 | @expect('D213: Multi-line docstring summary should start at the second line')
229 229 | def asdfsdf():
@ -115,7 +115,7 @@ D.py:240:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
237 237 | @expect('D207: Docstring is under-indented')
238 238 | @expect('D213: Multi-line docstring summary should start at the second line')
239 239 | def asdsdfsdffsdf():
@ -140,7 +140,7 @@ D.py:250:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
247 247 | @expect('D208: Docstring is over-indented')
248 248 | @expect('D213: Multi-line docstring summary should start at the second line')
249 249 | def asdfsdsdf24():
@ -165,7 +165,7 @@ D.py:260:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
257 257 | @expect('D208: Docstring is over-indented')
258 258 | @expect('D213: Multi-line docstring summary should start at the second line')
259 259 | def asdfsdsdfsdf24():
@ -190,7 +190,7 @@ D.py:270:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
267 267 | @expect('D208: Docstring is over-indented')
268 268 | @expect('D213: Multi-line docstring summary should start at the second line')
269 269 | def asdfsdfsdsdsdfsdf24():
@ -213,7 +213,7 @@ D.py:281:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
278 278 | 'line')
279 279 | @expect('D213: Multi-line docstring summary should start at the second line')
280 280 | def asdfljdf24():
@ -237,7 +237,7 @@ D.py:299:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
296 296 | @expect('D210: No whitespaces allowed surrounding docstring text')
297 297 | @expect('D213: Multi-line docstring summary should start at the second line')
298 298 | def multiline():
@ -263,7 +263,7 @@ D.py:343:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
340 340 |
341 341 | @expect('D213: Multi-line docstring summary should start at the second line')
342 342 | def exceptions_of_D301():
@ -288,7 +288,7 @@ D.py:383:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
380 380 |
381 381 | @expect('D213: Multi-line docstring summary should start at the second line')
382 382 | def new_209():
@ -313,7 +313,7 @@ D.py:392:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
389 389 |
390 390 | @expect('D213: Multi-line docstring summary should start at the second line')
391 391 | def old_209():
@ -337,7 +337,7 @@ D.py:438:37: D213 [*] Multi-line docstring summary should start at the second li
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
435 435 |
436 436 | @expect("D207: Docstring is under-indented")
437 437 | @expect('D213: Multi-line docstring summary should start at the second line')
@ -362,7 +362,7 @@ D.py:450:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
447 447 |
448 448 | @expect('D213: Multi-line docstring summary should start at the second line')
449 449 | def a_following_valid_function(x=None):
@ -391,7 +391,7 @@ D.py:526:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
523 523 | # This is reproducing a bug where AttributeError is raised when parsing class
524 524 | # parameters as functions for Google / Numpy conventions.
525 525 | class Blah: # noqa: D203,D213
@ -415,7 +415,7 @@ D.py:546:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
543 543 | @expect('D213: Multi-line docstring summary should start at the second line')
544 544 | def multiline_leading_space():
545 545 |
@ -441,7 +441,7 @@ D.py:555:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
552 552 | @expect('D202: No blank lines allowed after function docstring (found 1)')
553 553 | @expect('D213: Multi-line docstring summary should start at the second line')
554 554 | def multiline_trailing_space():
@ -467,7 +467,7 @@ D.py:568:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
565 565 | @expect('D213: Multi-line docstring summary should start at the second line')
566 566 | def multiline_trailing_and_leading_space():
567 567 |
@ -490,7 +490,7 @@ D.py:588:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
585 585 | 'line')
586 586 | @expect('D213: Multi-line docstring summary should start at the second line')
587 587 | def asdfljdjgf24():
@ -513,7 +513,7 @@ D.py:606:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
603 603 | '(found 3)')
604 604 | @expect('D212: Multi-line docstring summary should start at the first line')
605 605 | def one_liner():
@ -536,7 +536,7 @@ D.py:615:5: D213 [*] Multi-line docstring summary should start at the second lin
|
= help: Insert line break and indentation after opening quotes
Suggested fix
Fix
612 612 | '(found 3)')
613 613 | @expect('D212: Multi-line docstring summary should start at the first line')
614 614 | def one_liner():

View file

@ -19,7 +19,7 @@ D214_module.py:1:1: D214 [*] Section is over-indented ("Returns")
|
= help: Remove over-indentation from "Returns"
Suggested fix
Fix
1 1 | """A module docstring with D214 violations
2 2 |
3 |- Returns
@ -46,7 +46,7 @@ D214_module.py:1:1: D214 [*] Section is over-indented ("Args")
|
= help: Remove over-indentation from "Args"
Suggested fix
Fix
4 4 | -----
5 5 | valid returns
6 6 |

View file

@ -17,7 +17,7 @@ sections.py:144:5: D214 [*] Section is over-indented ("Returns")
|
= help: Remove over-indentation from "Returns"
Suggested fix
Fix
143 143 | def section_overindented(): # noqa: D416
144 144 | """Toggle the gizmo.
145 145 |

View file

@ -17,7 +17,7 @@ sections.py:156:5: D215 [*] Section underline is over-indented ("Returns")
|
= help: Remove over-indentation from "Returns" underline
Suggested fix
Fix
156 156 | """Toggle the gizmo.
157 157 |
158 158 | Returns
@ -41,7 +41,7 @@ sections.py:170:5: D215 [*] Section underline is over-indented ("Returns")
|
= help: Remove over-indentation from "Returns" underline
Suggested fix
Fix
170 170 | """Toggle the gizmo.
171 171 |
172 172 | Returns

View file

@ -11,7 +11,7 @@ D403.py:2:5: D403 [*] First word of the first line should be capitalized: `this`
|
= help: Capitalize `this` to `This`
Suggested fix
Fix
1 1 | def bad_function():
2 |- """this docstring is not capitalized"""
2 |+ """This docstring is not capitalized"""

View file

@ -17,7 +17,7 @@ sections.py:17:5: D405 [*] Section name should be properly capitalized ("returns
|
= help: Capitalize "returns"
Suggested fix
Fix
16 16 | def not_capitalized(): # noqa: D416
17 17 | """Toggle the gizmo.
18 18 |
@ -51,7 +51,7 @@ sections.py:216:5: D405 [*] Section name should be properly capitalized ("Short
|
= help: Capitalize "Short summary"
Suggested fix
Fix
215 215 | def multiple_sections(): # noqa: D416
216 216 | """Toggle the gizmo.
217 217 |

View file

@ -17,7 +17,7 @@ sections.py:30:5: D406 [*] Section name should end with a newline ("Returns")
|
= help: Add newline after "Returns"
Suggested fix
Fix
29 29 | def superfluous_suffix(): # noqa: D416
30 30 | """Toggle the gizmo.
31 31 |
@ -51,7 +51,7 @@ sections.py:216:5: D406 [*] Section name should end with a newline ("Raises")
|
= help: Add newline after "Raises"
Suggested fix
Fix
224 224 | Returns
225 225 | ------
226 226 | Many many wonderful things.

View file

@ -16,7 +16,7 @@ sections.py:42:5: D407 [*] Missing dashed underline after section ("Returns")
|
= help: Add dashed line under "Returns"
Suggested fix
Fix
42 42 | """Toggle the gizmo.
43 43 |
44 44 | Returns
@ -39,7 +39,7 @@ sections.py:54:5: D407 [*] Missing dashed underline after section ("Returns")
|
= help: Add dashed line under "Returns"
Suggested fix
Fix
54 54 | """Toggle the gizmo.
55 55 |
56 56 | Returns
@ -60,7 +60,7 @@ sections.py:65:5: D407 [*] Missing dashed underline after section ("Returns")
|
= help: Add dashed line under "Returns"
Suggested fix
Fix
64 64 | def no_underline_and_no_newline(): # noqa: D416
65 65 | """Toggle the gizmo.
66 66 |
@ -95,7 +95,7 @@ sections.py:216:5: D407 [*] Missing dashed underline after section ("Raises")
|
= help: Add dashed line under "Raises"
Suggested fix
Fix
225 225 | ------
226 226 | Many many wonderful things.
227 227 | Raises:
@ -124,7 +124,7 @@ sections.py:261:5: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
261 261 | """Toggle the gizmo.
262 262 |
263 263 | Args:
@ -153,7 +153,7 @@ sections.py:261:5: D407 [*] Missing dashed underline after section ("Returns")
|
= help: Add dashed line under "Returns"
Suggested fix
Fix
264 264 | note: A random string.
265 265 |
266 266 | Returns:
@ -182,7 +182,7 @@ sections.py:261:5: D407 [*] Missing dashed underline after section ("Raises")
|
= help: Add dashed line under "Raises"
Suggested fix
Fix
266 266 | Returns:
267 267 |
268 268 | Raises:
@ -206,7 +206,7 @@ sections.py:278:5: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
278 278 | """Toggle the gizmo.
279 279 |
280 280 | Args
@ -233,7 +233,7 @@ sections.py:293:9: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
295 295 | Will this work when referencing x?
296 296 |
297 297 | Args:
@ -257,7 +257,7 @@ sections.py:310:5: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
310 310 | """Toggle the gizmo.
311 311 |
312 312 | Args:
@ -283,7 +283,7 @@ sections.py:322:9: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
322 322 | """Test a valid args section.
323 323 |
324 324 | Args:
@ -309,7 +309,7 @@ sections.py:334:9: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
334 334 | """Test a valid args section.
335 335 |
336 336 | Args:
@ -336,7 +336,7 @@ sections.py:346:9: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
346 346 | """Test a valid args section.
347 347 |
348 348 | Args:
@ -362,7 +362,7 @@ sections.py:359:9: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
359 359 | """Test a valid args section.
360 360 |
361 361 | Args:
@ -388,7 +388,7 @@ sections.py:371:9: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
371 371 | """Test a valid args section.
372 372 |
373 373 | Args:
@ -418,7 +418,7 @@ sections.py:380:9: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
380 380 | """Do stuff.
381 381 |
382 382 | Args:
@ -444,7 +444,7 @@ sections.py:499:9: D407 [*] Missing dashed underline after section ("Args")
|
= help: Add dashed line under "Args"
Suggested fix
Fix
501 501 | Testing this incorrectly indented docstring.
502 502 |
503 503 | Args:

View file

@ -18,7 +18,7 @@ sections.py:94:5: D408 [*] Section underline should be in the line following the
|
= help: Add underline to "Returns"
Suggested fix
Fix
94 94 | """Toggle the gizmo.
95 95 |
96 96 | Returns

View file

@ -17,7 +17,7 @@ sections.py:108:5: D409 [*] Section underline should match the length of its nam
|
= help: Adjust underline length to match "Returns"
Suggested fix
Fix
108 108 | """Toggle the gizmo.
109 109 |
110 110 | Returns
@ -51,7 +51,7 @@ sections.py:216:5: D409 [*] Section underline should match the length of its nam
|
= help: Adjust underline length to match "Returns"
Suggested fix
Fix
222 222 | returns.
223 223 |
224 224 | Returns

View file

@ -22,7 +22,7 @@ sections.py:76:5: D410 [*] Missing blank line after section ("Returns")
|
= help: Add blank line after "Returns"
Suggested fix
Fix
77 77 |
78 78 | Returns
79 79 | -------
@ -55,7 +55,7 @@ sections.py:216:5: D410 [*] Missing blank line after section ("Returns")
|
= help: Add blank line after "Returns"
Suggested fix
Fix
224 224 | Returns
225 225 | ------
226 226 | Many many wonderful things.

View file

@ -22,7 +22,7 @@ sections.py:76:5: D411 [*] Missing blank line before section ("Yields")
|
= help: Add blank line before "Yields"
Suggested fix
Fix
77 77 |
78 78 | Returns
79 79 | -------
@ -48,7 +48,7 @@ sections.py:131:5: D411 [*] Missing blank line before section ("Returns")
|
= help: Add blank line before "Returns"
Suggested fix
Fix
131 131 | """Toggle the gizmo.
132 132 |
133 133 | The function's description.
@ -81,7 +81,7 @@ sections.py:216:5: D411 [*] Missing blank line before section ("Raises")
|
= help: Add blank line before "Raises"
Suggested fix
Fix
224 224 | Returns
225 225 | ------
226 226 | Many many wonderful things.

View file

@ -25,7 +25,7 @@ sections.py:216:5: D412 [*] No blank lines allowed between a section header and
|
= help: Remove blank line(s)
Suggested fix
Fix
217 217 |
218 218 | Short summary
219 219 | -------------

View file

@ -13,7 +13,7 @@ sections.py:65:5: D413 [*] Missing blank line after last section ("Returns")
|
= help: Add blank line after "Returns"
Suggested fix
Fix
64 64 | def no_underline_and_no_newline(): # noqa: D416
65 65 | """Toggle the gizmo.
66 66 |

View file

@ -11,7 +11,7 @@ D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a se
|
= help: Move closing quotes to new line
Suggested fix
Fix
1 1 | def lorem():
2 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit
3 |- sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"""