docstring-format-checker 1.8.0__tar.gz → 1.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {docstring_format_checker-1.8.0 → docstring_format_checker-1.9.0}/PKG-INFO +1 -1
- {docstring_format_checker-1.8.0 → docstring_format_checker-1.9.0}/pyproject.toml +2 -1
- {docstring_format_checker-1.8.0 → docstring_format_checker-1.9.0}/src/docstring_format_checker/core.py +23 -5
- {docstring_format_checker-1.8.0 → docstring_format_checker-1.9.0}/README.md +0 -0
- {docstring_format_checker-1.8.0 → docstring_format_checker-1.9.0}/src/docstring_format_checker/__init__.py +0 -0
- {docstring_format_checker-1.8.0 → docstring_format_checker-1.9.0}/src/docstring_format_checker/cli.py +0 -0
- {docstring_format_checker-1.8.0 → docstring_format_checker-1.9.0}/src/docstring_format_checker/config.py +0 -0
- {docstring_format_checker-1.8.0 → docstring_format_checker-1.9.0}/src/docstring_format_checker/utils/__init__.py +0 -0
- {docstring_format_checker-1.8.0 → docstring_format_checker-1.9.0}/src/docstring_format_checker/utils/exceptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docstring-format-checker
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: A CLI tool to check and validate Python docstring formatting and completeness
|
|
5
5
|
Author: Chris Mahoney
|
|
6
6
|
Author-email: Chris Mahoney <docstring-format-checker@data-science-extensions.com>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "docstring-format-checker"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.9.0"
|
|
4
4
|
description = "A CLI tool to check and validate Python docstring formatting and completeness"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -114,6 +114,7 @@ filterwarnings = [
|
|
|
114
114
|
addopts = [
|
|
115
115
|
"--verbose",
|
|
116
116
|
"--verbose",
|
|
117
|
+
"--diff-width=120",
|
|
117
118
|
"--cov=src/docstring_format_checker",
|
|
118
119
|
"--cov-report=term",
|
|
119
120
|
"--cov-report=html:cov-report/html",
|
|
@@ -1000,7 +1000,7 @@ class DocstringChecker:
|
|
|
1000
1000
|
List of parameter names found in the Params section.
|
|
1001
1001
|
"""
|
|
1002
1002
|
documented_params: list[str] = []
|
|
1003
|
-
param_pattern: str = r"^\s*(\w+)\s*\([^)]+\):"
|
|
1003
|
+
param_pattern: str = r"^\s*(\*{0,2}\w+)\s*\([^)]+\):"
|
|
1004
1004
|
lines: list[str] = docstring.split("\n")
|
|
1005
1005
|
in_params_section: bool = False
|
|
1006
1006
|
|
|
@@ -1039,12 +1039,30 @@ class DocstringChecker:
|
|
|
1039
1039
|
"""
|
|
1040
1040
|
error_parts: list[str] = []
|
|
1041
1041
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1042
|
+
# Create copies to avoid mutating inputs
|
|
1043
|
+
missing_copy: list[str] = list(missing_in_docstring)
|
|
1044
|
+
extra_copy: list[str] = list(extra_in_docstring)
|
|
1045
|
+
|
|
1046
|
+
# Check for asterisk mismatch
|
|
1047
|
+
# We iterate over a copy of missing_copy to allow modification
|
|
1048
|
+
for missing in list(missing_copy):
|
|
1049
|
+
for extra in list(extra_copy):
|
|
1050
|
+
if extra.lstrip("*") == missing:
|
|
1051
|
+
asterisk_count: int = len(extra) - len(extra.lstrip("*"))
|
|
1052
|
+
asterisk_word: str = "asterisk" if asterisk_count == 1 else "asterisks"
|
|
1053
|
+
error_parts.append(
|
|
1054
|
+
f" - Parameter '{missing}' found in docstring as '{extra}'. Please remove the {asterisk_word}."
|
|
1055
|
+
)
|
|
1056
|
+
missing_copy.remove(missing)
|
|
1057
|
+
extra_copy.remove(extra)
|
|
1058
|
+
break
|
|
1059
|
+
|
|
1060
|
+
if missing_copy:
|
|
1061
|
+
missing_str: str = "', '".join(missing_copy)
|
|
1044
1062
|
error_parts.append(f" - In signature but not in docstring: '{missing_str}'")
|
|
1045
1063
|
|
|
1046
|
-
if
|
|
1047
|
-
extra_str: str = "', '".join(
|
|
1064
|
+
if extra_copy:
|
|
1065
|
+
extra_str: str = "', '".join(extra_copy)
|
|
1048
1066
|
error_parts.append(f" - In docstring but not in signature: '{extra_str}'")
|
|
1049
1067
|
|
|
1050
1068
|
return "Parameter mismatch:\n" + "\n".join(error_parts)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|