Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 5b69acd

Browse files
committed
Fix types of skips
1 parent 7d3f471 commit 5b69acd

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

docs/release_notes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ New Features
1919
* Added the ability to ignore specific function and method doctstrings with
2020
comments:
2121

22-
1. "# noqa" or "# pydocstyle: noqa" skips all checks.
22+
1. "# noqa" skips all checks.
2323

24-
2. "# pydocstyle: D102,D203" can be used to skip specific checks.
24+
2. "# noqa: D102,D203" can be used to skip specific checks.
2525

2626
Bug Fixes
2727

docs/snippets/per_file.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
``pydocstyle`` inline commenting to skip specific checks on specific
22
functions or methods. The supported comments that can be added are:
33

4-
1. ``"# noqa"`` or ``"# pydocstyle: noqa"`` skips all checks.
4+
1. ``"# noqa"`` skips all checks.
55

6-
2. ``"# pydocstyle: D102,D203"`` can be used to skip specific checks.
6+
2. ``"# noqa: D102,D203"`` can be used to skip specific checks. Note that
7+
this is compatible with skips from `flake8 <http://flake8.pycqa.org/>`_,
8+
e.g. ``# noqa: D102,E501,D203``.
79

810
For example, this will skip the check for a period at the end of a function
911
docstring::
1012

11-
>>> def bad_function(): # pydocstyle: D400
13+
>>> def bad_function(): # noqa: D400
1214
... """Omit a period in the docstring as an exception"""
1315
... pass

src/pydocstyle.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,10 @@ def parse_definition(self, class_):
472472
skips = ''
473473
if self.current.kind in (tk.NEWLINE, tk.COMMENT):
474474
if self.current.kind == tk.COMMENT:
475-
if self.current.value.startswith('# noqa') or \
476-
'pydocstyle: noqa' in self.current.value:
475+
if 'noqa: ' in self.current.value:
476+
skips = ''.join(self.current.value.split('noqa: ')[1:])
477+
elif self.current.value.startswith('# noqa'):
477478
skips = 'all'
478-
elif 'pydocstyle: ' in self.current.value:
479-
skips = ''.join(self.current.value.split(
480-
'pydocstyle: ')[1:])
481479
self.leapfrog(tk.INDENT)
482480
assert self.current.kind != tk.INDENT
483481
docstring = self.parse_docstring()

src/tests/test_cases/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,13 @@ def docstring_bad_ignore_all(): # noqa
352352
pass
353353

354354

355-
def docstring_bad_ignore_all_2(): # pydocstyle: noqa
355+
def docstring_bad_ignore_one(): # noqa: D400,D401
356356
"""Runs something"""
357357
pass
358358

359359

360360
@expect("D401: First line should be in imperative mood ('Run', not 'Runs')")
361-
def docstring_bad_ignore_one(): # pydocstyle: D400
361+
def docstring_ignore_violations_of_pydocstyle_D400_and_PEP8_E501_but_catch_D401(): # noqa: E501,D400
362362
"""Runs something"""
363363
pass
364364

0 commit comments

Comments
 (0)