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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docstring-format-checker
3
- Version: 0.7.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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "docstring-format-checker"
3
- version = "v0.7.0"
3
+ version = "v0.8.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"
@@ -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.0"
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
- # Pattern: name (type): or (type):
1019
- # But skip if it doesn't look like a parameter definition (e.g., has multiple words before the colon)
1020
- colon_part = stripped_line.split(":")[0].strip()
1021
- # Skip if it contains phrases that indicate it's a description, not a parameter
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
- if not re.search(r"\([^)]+\):", stripped_line):
1028
- errors.append(
1029
- f"Section '{current_section.name}' (type: '{current_section.type}') requires "
1030
- f"parenthesized types, see: '{stripped_line}'"
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