From ac56b83e0e65ed4310f3d9f2b6ace1bc9e252d12 Mon Sep 17 00:00:00 2001 From: Sambhav Kothari Date: Thu, 28 May 2020 05:16:54 +0100 Subject: [PATCH 1/3] Fix bug with google style arg regex (#448) Currently, due to the way the regex was specified, the regex matcher was getting thrown off by types that used colons. This change makes the regex robust to such type and fixes #443 --- docs/release_notes.rst | 2 ++ src/pydocstyle/checker.py | 6 +++--- src/tests/test_cases/sections.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 13c677fb..01458c23 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -15,6 +15,8 @@ Bug Fixes * Update convention support documentation (#386, #393) * Detect inner asynchronous functions for D202 (#467) +* Fix a bug in parsing Google-style argument description. + The bug caused some argument names to go unreported in D417 (#448). 5.0.2 - January 8th, 2020 --------------------------- diff --git a/src/pydocstyle/checker.py b/src/pydocstyle/checker.py index f5b34f32..ae608068 100644 --- a/src/pydocstyle/checker.py +++ b/src/pydocstyle/checker.py @@ -96,9 +96,9 @@ class ConventionChecker: r"(\w+)" # Followed by 1 or more unicode chars, numbers or underscores # The above is captured as the first group as this is the paramater name. r"\s*" # Followed by 0 or more whitespace characters - r"\(?(.*?)\)?" # Matches patterns contained within round brackets. - # The `(.*?)` is the second capturing group which matches any sequence of - # characters in a non-greedy way (denoted by the `*?`) + r"(\(.*?\))?" # Matches patterns contained within round brackets. + # The `.*?`matches any sequence of characters in a non-greedy + # way (denoted by the `*?`) r"\s*" # Followed by 0 or more whitespace chars r":" # Followed by a colon ".+" # Followed by 1 or more characters - which is the docstring for the parameter diff --git a/src/tests/test_cases/sections.py b/src/tests/test_cases/sections.py index 00609386..f8158ec7 100644 --- a/src/tests/test_cases/sections.py +++ b/src/tests/test_cases/sections.py @@ -335,6 +335,36 @@ def test_missing_args_static_method(a, x, y, _test, z=3): # noqa: D213, D407 """ + @staticmethod + @expect("D417: Missing argument descriptions in the docstring " + "(argument(s) a, b are missing descriptions in " + "'test_missing_docstring' docstring)", arg_count=2) + def test_missing_docstring(a, b): # noqa: D213, D407 + """Test a valid args section. + + Args: + a: + + """ + + @staticmethod + @expect("D417: Missing argument descriptions in the docstring " + "(argument(s) skip, verbose are missing descriptions in " + "'test_missing_docstring_another' docstring)", arg_count=2) + def test_missing_docstring_another(skip, verbose): # noqa: D213, D407 + """Do stuff. + + Args: + skip (:attr:`.Skip`): + Lorem ipsum dolor sit amet, consectetur adipiscing elit. + Etiam at tellus a tellus faucibus maximus. Curabitur tellus + mauris, semper id vehicula ac, feugiat ut tortor. + verbose (bool): + If True, print out as much infromation as possible. + If False, print out concise "one-liner" information. + + """ + @expect(_D213) @expect("D417: Missing argument descriptions in the docstring " From 9429e2f054072af27c0b236a14f9dfdd42c056c3 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 12 Jun 2020 09:09:42 +0300 Subject: [PATCH 2/3] Fix exception cause in config.py (#488) --- src/pydocstyle/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pydocstyle/config.py b/src/pydocstyle/config.py index e1fbc0a9..60d11f00 100644 --- a/src/pydocstyle/config.py +++ b/src/pydocstyle/config.py @@ -463,7 +463,7 @@ def _expand_error_codes(code_parts): 'known errors: %s', part) expanded_codes.update(codes_to_add) except TypeError as e: - raise IllegalConfiguration(e) + raise IllegalConfiguration(e) from e return expanded_codes From 75dabda50e6907c7408c06d9d47fe029302fa70e Mon Sep 17 00:00:00 2001 From: Charles Patel Date: Tue, 16 Jun 2020 08:51:42 -0700 Subject: [PATCH 3/3] =?UTF-8?q?Added=20updated=20link=20to=20pydocstyle?= =?UTF-8?q?=E2=80=99s=20documentation=20(#489)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added updated link * updated link --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 1957ea33..f55e05ff 100644 --- a/README.rst +++ b/README.rst @@ -55,7 +55,7 @@ Run Links ----- -* `Read the full documentation here `_. +* `Read the full documentation here `_. * `Fork pydocstyle on GitHub `_.