docstring-format-checker 1.6.3__tar.gz → 1.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: 1.6.3
3
+ Version: 1.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 = "1.6.3"
3
+ version = "1.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"
@@ -75,7 +75,7 @@ docs = [
75
75
  "pygithub==2.*",
76
76
  ]
77
77
  test = [
78
- "mypy==1.*,!=1.17.*",
78
+ "ty==0.*",
79
79
  "parameterized==0.*",
80
80
  "pytest==8.*",
81
81
  "pytest-clarity==1.*",
@@ -154,10 +154,12 @@ disable = [
154
154
  "C0103", # invalid-name
155
155
  "C0301", # line-too-long
156
156
  "C0302", # too-many-lines
157
+ "R0912", # too-many-branches
157
158
  "R0913", # too-many-arguments
158
159
  "R0914", # too-many-locals
159
160
  "R0915", # too-many-statements
160
161
  "R0917", # too-many-positional-arguments
162
+ "R1702", # too-many-nested-blocks
161
163
  "R1705", # no-else-return
162
164
  "R1724", # no-else-continue
163
165
  "W0107", # unnecessary-pass
@@ -188,6 +190,7 @@ allow_undefined_sections = false
188
190
  require_docstrings = true
189
191
  check_private = true
190
192
  validate_param_types = true
193
+ optional_style = "silent" #<-- optional: "silent", "validate", or "strict"
191
194
  sections = [
192
195
  { order=1, name="summary", type="free_text", required=true, admonition="note", prefix="!!!" },
193
196
  { order=2, name="details", type="free_text", required=false, admonition="abstract", prefix="???+" },
@@ -271,6 +271,7 @@ def _show_config_example_callback() -> None:
271
271
  [blue]require_docstrings = true[/blue]
272
272
  [blue]check_private = true[/blue]
273
273
  [blue]validate_param_types = true[/blue]
274
+ [blue]optional_style = "validate"[/blue] [green]# "silent", "validate", or "strict"[/green]
274
275
  [blue]sections = [[/blue]
275
276
  [blue]{ order = 1, name = "summary", type = "free_text", required = true, admonition = "note", prefix = "!!!" },[/blue]
276
277
  [blue]{ order = 2, name = "details", type = "free_text", required = false, admonition = "abstract", prefix = "???+" },[/blue]
@@ -357,9 +358,6 @@ def _format_error_messages(error_message: str) -> str:
357
358
  (str):
358
359
  Formatted error message with each error prefixed with "- " and separated by ";\n"
359
360
  """
360
- # Escape square brackets for Rich markup using Rich's escape function
361
- error_message = escape(error_message)
362
-
363
361
  if "; " in error_message:
364
362
  # Split by semicolon and rejoin with proper formatting
365
363
  errors: list[str] = error_message.split("; ")
@@ -115,6 +115,7 @@ class GlobalConfig:
115
115
  require_docstrings: bool = True
116
116
  check_private: bool = False
117
117
  validate_param_types: bool = True
118
+ optional_style: Literal["silent", "validate", "strict"] = "validate"
118
119
 
119
120
 
120
121
  ## --------------------------------------------------------------------------- #
@@ -447,11 +448,20 @@ def _parse_global_config(tool_config: dict[str, Any]) -> GlobalConfig:
447
448
  (GlobalConfig):
448
449
  Parsed global configuration object.
449
450
  """
451
+ # Validate optional_style if provided
452
+ optional_style: str = tool_config.get("optional_style", "validate")
453
+ valid_styles: tuple[str, str, str] = ("silent", "validate", "strict")
454
+ if optional_style not in valid_styles:
455
+ raise InvalidConfigError(
456
+ f"Invalid optional_style: '{optional_style}'. Must be one of: {', '.join(valid_styles)}"
457
+ )
458
+
450
459
  return GlobalConfig(
451
460
  allow_undefined_sections=tool_config.get("allow_undefined_sections", False),
452
461
  require_docstrings=tool_config.get("require_docstrings", True),
453
462
  check_private=tool_config.get("check_private", False),
454
463
  validate_param_types=tool_config.get("validate_param_types", True),
464
+ optional_style=optional_style, # type:ignore
455
465
  )
456
466
 
457
467