docstring-format-checker 0.7.0__tar.gz → 0.8.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-0.7.0 → docstring_format_checker-0.8.0}/PKG-INFO +1 -1
- {docstring_format_checker-0.7.0 → docstring_format_checker-0.8.0}/pyproject.toml +1 -1
- {docstring_format_checker-0.7.0 → docstring_format_checker-0.8.0}/src/docstring_format_checker/__init__.py +1 -1
- {docstring_format_checker-0.7.0 → docstring_format_checker-0.8.0}/src/docstring_format_checker/core.py +35 -12
- {docstring_format_checker-0.7.0 → docstring_format_checker-0.8.0}/README.md +0 -0
- {docstring_format_checker-0.7.0 → docstring_format_checker-0.8.0}/src/docstring_format_checker/cli.py +0 -0
- {docstring_format_checker-0.7.0 → docstring_format_checker-0.8.0}/src/docstring_format_checker/config.py +0 -0
- {docstring_format_checker-0.7.0 → docstring_format_checker-0.8.0}/src/docstring_format_checker/utils/__init__.py +0 -0
- {docstring_format_checker-0.7.0 → docstring_format_checker-0.8.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: 0.
|
|
3
|
+
Version: 0.8.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>
|
|
@@ -4,7 +4,7 @@ Docstring Format Checker.
|
|
|
4
4
|
A CLI tool to check and validate Python docstring formatting and completeness.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
__version__ = "v0.
|
|
7
|
+
__version__ = "v0.8.0"
|
|
8
8
|
__author__ = "Chris Mahoney"
|
|
9
9
|
__email__ = "docstring-format-checker@data-science-extensions.com"
|
|
10
10
|
|
|
@@ -1015,19 +1015,42 @@ class DocstringChecker:
|
|
|
1015
1015
|
)
|
|
1016
1016
|
# For list_name_and_type sections, check format like "name (type):" or "(type):"
|
|
1017
1017
|
elif current_section.type == "list_name_and_type":
|
|
1018
|
-
#
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
if any(
|
|
1023
|
-
word in colon_part.lower() for word in ["default", "output", "format", "show", "example"]
|
|
1024
|
-
):
|
|
1018
|
+
# Check if this line has parentheses and looks like a parameter definition
|
|
1019
|
+
if re.search(r"\([^)]+\):", stripped_line):
|
|
1020
|
+
# This is a valid parameter definition line, remember its indentation
|
|
1021
|
+
type_line_indent = current_indent
|
|
1025
1022
|
continue
|
|
1023
|
+
else:
|
|
1024
|
+
# Check if this is likely a description line based on various criteria
|
|
1025
|
+
colon_part = stripped_line.split(":")[0].strip()
|
|
1026
|
+
|
|
1027
|
+
# Skip if it contains phrases that indicate it's a description, not a parameter
|
|
1028
|
+
if any(
|
|
1029
|
+
word in colon_part.lower()
|
|
1030
|
+
for word in ["default", "output", "format", "show", "example"]
|
|
1031
|
+
):
|
|
1032
|
+
continue
|
|
1026
1033
|
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1034
|
+
# Skip if it starts with bullet points or list markers
|
|
1035
|
+
if stripped_line.strip().startswith(("-", "*", "•", "+")):
|
|
1036
|
+
continue
|
|
1037
|
+
|
|
1038
|
+
# If we have found a parameter definition, check if this is a description line
|
|
1039
|
+
if type_line_indent is not None:
|
|
1040
|
+
# Skip if this is more indented than the parameter definition (description line)
|
|
1041
|
+
if current_indent > type_line_indent:
|
|
1042
|
+
continue
|
|
1043
|
+
|
|
1044
|
+
# Skip if the line before the colon contains multiple words (likely description)
|
|
1045
|
+
words_before_colon = colon_part.split()
|
|
1046
|
+
if len(words_before_colon) > 2: # More than "param_name (type)"
|
|
1047
|
+
continue
|
|
1048
|
+
|
|
1049
|
+
# Only flag lines that could reasonably be parameter definitions
|
|
1050
|
+
if ":" in stripped_line and not stripped_line.strip().startswith("#"):
|
|
1051
|
+
errors.append(
|
|
1052
|
+
f"Section '{current_section.name}' (type: '{current_section.type}') requires "
|
|
1053
|
+
f"parenthesized types, see: '{stripped_line}'"
|
|
1054
|
+
)
|
|
1032
1055
|
|
|
1033
1056
|
return errors
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|