Skip to content

v1.10.0 - Enhance Section Validation and Update Dependencies

Choose a tag to compare

@chrimaho chrimaho released this 04 Jan 00:34
· 146 commits to main since this release

πŸ“ Summary

This release focuses on improving the robustness of docstring section validation, particularly regarding case sensitivity and error reporting. Standardise section header detection to handle various capitalisation styles while preserving original casing in error messages. Modernise the project's dependency management by introducing Dependabot and upgrading several pre-commit hooks. Refactor utility scripts for better clarity and update package metadata to align with standard practices. Ensure a more consistent and user-friendly experience through these enhancements.

πŸ“Š Release Statistics

Attribute Note
Version: v1.10.0
Python Support: 3.9, 3.10, 3.11, 3.12, 3.13, 3.14
Test Coverage: 100% (1035 statements, +2 from v1.9.0)
Pylint Score: 10.00/10
Complexity: All functions ≀13 threshold
Functions: 106 (unchanged from v1.9.0)
Tests Passing: 250/250 (unchanged from v1.9.0)
Files Changed: 8
Lines Added: 76
Lines Removed: 53
Commits: 10
Pull Requests Merged: 1 (PR #29)

🎯 Enhance Docstring Section Validation

πŸ” Overview

Improve the reliability of section detection and validation within docstrings. Ensure that the tool correctly identifies configured sections regardless of their case in the docstring, while providing clearer error messages.

πŸ› οΈ Key Improvements

Case-Insensitive Matching

Refactor several internal methods to handle section names more robustly. Lowercase section names for configuration lookups but preserve the original case when reporting errors to the user.

  • Update ._validate_single_admonition() to use a lowercased version of the section title for configuration checks.
  • Refactor ._validate_admonition_has_no_colon() to ensure consistent case-insensitive lookup.
  • Improve ._check_non_admonition_colon_usage() to correctly identify non-admonition sections regardless of case.
  • Standardise section header detection in ._detect_any_section_header() and ._detect_section_header().

Clearer Error Reporting

Update ._validate_all_required_sections() to wrap missing section names in single quotes. This makes the error messages more readable and consistent with other validation errors.

Example of new output:
Missing required section: 'summary'

βš™οΈ Update Dependencies and CI/CD Workflows

πŸ” Overview

Modernise the development environment and automate dependency maintenance to ensure the project remains secure and up-to-date.

πŸ› οΈ Key Improvements

Automate Dependency Updates

Introduce a new .github/dependabot.yml configuration to enable weekly automated updates for GitHub Actions. Include custom labels and designated reviewers to streamline the maintenance process.

Upgrade Pre-commit Hooks

Bump the versions of several key pre-commit hooks to leverage the latest improvements and bug fixes:

Hook Old Version New Version
black 25.1.0 25.12.0
blacken-docs 1.19.1 1.20.0
isort 6.0.1 7.0.0
pyupgrade v3.20.0 v3.21.2
pycln v2.5.0 v2.6.0
uv-pre-commit 0.8.8 0.9.21

Refine CI/CD Workflow

Update the .github/workflows/cd.yml workflow to use ${{ env.VERSION }} consistently for version references. Expose GITHUB_TOKEN and REPOSITORY_NAME to the changelog generation step to ensure it has the necessary context.

🧹 Refactor Utility Scripts and Metadata

πŸ” Overview

Clean up internal utility scripts and ensure package metadata is correctly defined.

πŸ› οΈ Key Improvements

Improve Script Clarity

Add a comprehensive file header to src/utils/scripts.py that outlines its purpose, usage, and provides examples. Improve the discoverability and usability of the internal tooling.

Simplify Git Operations

Refactor git_fix_tag_reference() to remove redundant comments and simplify the implementation. Fix a minor formatting issue in git_refresh_current_branch() by removing an extra space in the git pull command.

Update Package Metadata

Refactor src/docstring_format_checker/__init__.py to use the correct Author-email metadata key. Ensure that the author's email is correctly exposed in the package metadata as __author_email__.

πŸ§ͺ Improve Test Consistency

πŸ” Overview

Update the test suite to align with the improved error message formatting.

πŸ› οΈ Key Improvements

Update Assertions

Refactor tests in src/tests/test_cli.py and src/tests/test_core.py to expect the new quoted format for missing section errors. Ensure that the test suite remains in sync with the core validation logic.

What's Changed

  • Enhance Section Validation and Update Dependencies by @chrimaho in #28

Full Changelog: v1.9.0...v1.10.0