From c27d7631306c31d911d441d6e8fde2c084485a83 Mon Sep 17 00:00:00 2001 From: Thomas Bean <47thomasj@gmail.com> Date: Tue, 24 Jun 2025 11:34:28 -0600 Subject: [PATCH 1/3] things --- checkers/common_nodes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/checkers/common_nodes.py b/checkers/common_nodes.py index ede45a4..869096f 100644 --- a/checkers/common_nodes.py +++ b/checkers/common_nodes.py @@ -233,16 +233,19 @@ def _check_docstring_format(node: ast.FunctionDef|ast.ClassDef, docstring: str, errors = [] if not docstring: return errors - first_line = docstring.split('\n')[0].strip() + summary = docstring.split('\n\n')[0].strip() + first_line = summary.split('\n')[0].strip() + last_line = summary.split('\n')[-1].strip() # Check capitalization if first_line and first_line[0].islower(): error = error_creation_module.create_error(node, 'D200', "Docstring should start with capital letter", file_path, ignore_codes) if error: errors.append(error) + # Check ending punctuation - if first_line and not first_line.endswith('.'): + if last_line and not last_line.endswith('.'): error = error_creation_module.create_error(node, 'D201', "Docstring should end with period", file_path, ignore_codes) if error: errors.append(error) From b116e4d0f31d0e3fd82fa68fb001a330785d57f1 Mon Sep 17 00:00:00 2001 From: Thomas Bean <47thomasj@gmail.com> Date: Tue, 24 Jun 2025 11:35:28 -0600 Subject: [PATCH 2/3] one more --- checkers/common_nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checkers/common_nodes.py b/checkers/common_nodes.py index 869096f..3defab0 100644 --- a/checkers/common_nodes.py +++ b/checkers/common_nodes.py @@ -231,7 +231,7 @@ def _check_docstring_format(node: ast.FunctionDef|ast.ClassDef, docstring: str, list of style errors found """ errors = [] - if not docstring: + if not docstring.strip(): return errors summary = docstring.split('\n\n')[0].strip() first_line = summary.split('\n')[0].strip() From a6e0cf755d43f8913ced33dcb9c82f1bc527810f Mon Sep 17 00:00:00 2001 From: Thomas Bean <47thomasj@gmail.com> Date: Tue, 24 Jun 2025 11:36:15 -0600 Subject: [PATCH 3/3] nvm --- checkers/common_nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checkers/common_nodes.py b/checkers/common_nodes.py index 3defab0..869096f 100644 --- a/checkers/common_nodes.py +++ b/checkers/common_nodes.py @@ -231,7 +231,7 @@ def _check_docstring_format(node: ast.FunctionDef|ast.ClassDef, docstring: str, list of style errors found """ errors = [] - if not docstring.strip(): + if not docstring: return errors summary = docstring.split('\n\n')[0].strip() first_line = summary.split('\n')[0].strip()