Skip to content

Conversation

@ternaus
Copy link
Owner

@ternaus ternaus commented May 21, 2025

Summary by Sourcery

Introduce explicit path configuration for the docstring checker, update default behavior to skip scanning when no paths are provided, add corresponding tests, clarify pre-commit documentation, and bump related tool and project versions.

Enhancements:

  • Require explicit paths for docstring checking by default and exit gracefully with a message when none are specified

CI:

  • Upgrade pyproject-fmt to v2.6.0 and ruff to v0.11.10 in pre-commit configuration

Documentation:

  • Clarify in .pre-commit-hooks.yaml that paths must be configured in pyproject.toml

Tests:

  • Add tests for handling no paths specified and using configured paths

Chores:

  • Bump project version to 0.0.8

@ternaus ternaus requested a review from Copilot May 21, 2025 22:10
@sourcery-ai
Copy link

sourcery-ai bot commented May 21, 2025

Reviewer's Guide

This PR modifies the docstring checker to require explicit path configuration by default (adding an early exit and message when no paths are specified), extends test coverage for both no-path and configured-path scenarios, updates pre-commit hook documentation and dependency versions, and bumps the project version.

File-Level Changes

Change Details Files
Require explicit configuration of paths and early exit when none are provided
  • Changed default 'paths' config to an empty list instead of scanning current directory
  • Inserted a check in main() to detect empty paths, print guidance, and exit with code 0
tools/check_docstrings.py
Add tests for no-paths and configured-path behavior
  • Introduced test_no_paths_specified to assert success and message when no paths are set
  • Added test_configured_paths to verify checker only scans configured directories and fails on errors there
tests/test_docstring_checker/test_check_docstrings.py
Enhance pre-commit hook documentation to emphasize required configuration
  • Updated hook description to instruct users to configure 'paths' under [tool.docstring_checker]
  • Provided example snippet for setting paths in .pre-commit-hooks.yaml
.pre-commit-hooks.yaml
Bump pre-commit hook dependency versions
  • Upgraded pyproject-fmt hook from rev v2.5.1 to v2.6.0
  • Upgraded ruff hook from rev v0.11.2 to v0.11.10
.pre-commit-config.yaml
Increment project version
  • Updated version in pyproject.toml from 0.0.7 to 0.0.8
pyproject.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the configuration for the docstring checker and updates pre-commit hook instructions to ensure users explicitly specify paths. Key changes include:

  • Changing the default "paths" configuration to empty and adding a check with an exit message when no paths are provided.
  • Adding tests to verify behavior when no paths are specified and when specific paths are configured.
  • Bumping versions and updating configuration instructions in pyproject.toml and pre-commit hook files.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/check_docstrings.py Updated default configuration and added an early exit with an explanatory message if no paths are specified.
tests/test_docstring_checker/test_check_docstrings.py Added tests for scenarios with no specified paths and with configured paths.
pyproject.toml Incremented version from "0.0.7" to "0.0.8".
.pre-commit-hooks.yaml Updated documentation to emphasize the configuration requirement for paths.
.pre-commit-config.yaml Updated dependency versions for pyproject-fmt and ruff.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ternaus - I've reviewed your changes - here's some feedback:

  • Changing the default paths from ['.'] to [] is a breaking change—consider preserving backward compatibility or at least issuing a deprecation warning or bumping the major version.
  • Printing the ‘No paths specified for checking…’ message to stdout can be confused with normal output; consider logging to stderr or shortening the message for clarity.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ternaus ternaus merged commit 63a9b13 into main May 21, 2025
17 checks passed
@ternaus ternaus deleted the fix_pre-commit_hook branch May 21, 2025 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant