Skip to content

Conversation

@cesarcoatl
Copy link
Member

@cesarcoatl cesarcoatl commented Aug 8, 2025

update flake8 configuration
add back the style testenv for tox

Summary by Sourcery

Introduce a dedicated style test environment, integrate pydoclint into the Flake8 pipeline, and refine pre-commit settings for auto-fixing and commit messaging.

New Features:

  • Add a new tox testenv 'style' for unified code formatting and linting using black, isort, docformatter, sort-all, ssort, unimport, flake8, pydoclint, and pydocstyle.

Enhancements:

  • Extend Flake8 configuration to run pydoclint checks under Google docstring style and merge DOC rules configuration.
  • Remove the standalone pydoclint-flake8 hook in pre-commit and add pydoclint as an additional dependency to the flake8-incendium hook.

CI:

  • Add autofix_commit_msg template in pre-commit autoupdate configuration.

update flake8 configuration
add back the style testenv for tox
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Aug 8, 2025

Reviewer's Guide

Introduces a dedicated style test environment in tox for unified formatting and documentation linting (including pydoclint), refines flake8/pydoclint settings in tox.ini, and updates the pre-commit configuration to integrate pydoclint under the flake8-incendium hook while removing its standalone hook.

Class diagram for flake8 and pydoclint configuration changes

classDiagram
    class ToxIni {
        +[testenv:style] section
        +deps: black, docformatter, flake8, isort, pydoclint, pydocstyle, sort-all, ssort, unimport
        +commands: sort-all, ssort, black, unimport, isort, docformatter, flake8, pydocstyle
        +[flake8] section
        +[pydoclint] options: style, arg-type-hints-in-signature, arg-type-hints-in-docstring, check-return-types
    }
    class PreCommitConfig {
        +flake8-incendium hook
        +additional_dependencies: pydoclint
        -pydoclint-flake8 hook (removed)
    }
    ToxIni <--> PreCommitConfig : shares config for style checks
Loading

Flow diagram for style testenv execution in tox

flowchart TD
    A[Start style testenv] --> B[Run sort-all on src/*.py]
    B --> C[Run ssort on src]
    C --> D[Run black on src]
    D --> E[Run unimport on src]
    E --> F[Run isort with tox.ini on src]
    F --> G[Run docformatter on src]
    G --> H[Run flake8 with DOC checks]
    H --> I[Run pydocstyle on src/system]
    I --> J[End]
Loading

File-Level Changes

Change Details Files
Add a dedicated style testenv in tox for unified formatting and doc linting
  • Define [testenv:style] with python3.12 and skip_install
  • Include Black, isort, docformatter, flake8, pydoclint, pydocstyle, sort-all, ssort, unimport as deps
  • Chain commands: sort-all, ssort, black, unimport, isort, docformatter, flake8 (DOC), pydocstyle
incendium/tox.ini
Refine flake8 and pydoclint settings in tox.ini
  • Set pydoclint style to google
  • Reorder and enable arg-type-hints-in-signature
  • Disable return type checking
incendium/tox.ini
Streamline pre-commit hooks to integrate pydoclint
  • Add autofix commit message template
  • Add pydoclint as additional_dependency for flake8-incendium hook
  • Remove standalone pydoclint-flake8 hook entry
.pre-commit-config.yaml

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
Contributor

@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 @cesarcoatl - I've reviewed your changes - here's some feedback:

  • Verify that adding pydoclint as an additional dependency to the flake8-incendium hook actually invokes pydoclint checks, since the explicit pydoclint-flake8 hook was removed.
  • Consider pinning pydoclint to a specific version in both tox and pre-commit configs to avoid unexpected failures when new releases introduce breaking changes.
  • The inline sort-all + ssort invocation could be wrapped in a small helper script or Makefile target to simplify the style testenv commands and reduce inline Python logic.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Verify that adding pydoclint as an additional dependency to the flake8-incendium hook actually invokes pydoclint checks, since the explicit pydoclint-flake8 hook was removed.
- Consider pinning pydoclint to a specific version in both tox and pre-commit configs to avoid unexpected failures when new releases introduce breaking changes.
- The inline sort-all + ssort invocation could be wrapped in a small helper script or Makefile target to simplify the style testenv commands and reduce inline Python logic.

## Individual Comments

### Comment 1
<location> `incendium/tox.ini:61` </location>
<code_context>
+      --recursive \
+      src
+    flake8 --select=DOC --config=tox.ini src
+    pydocstyle --config=tox.ini src{/}system
+
 [type]
</code_context>

<issue_to_address>
The path 'src{/}system' may not match intended files.

Verify that 'src{/}system' resolves as intended across platforms; consider using 'src/system' if platform independence is not required.
</issue_to_address>

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.

--recursive \
src
flake8 --select=DOC --config=tox.ini src
pydocstyle --config=tox.ini src{/}system
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: The path 'src{/}system' may not match intended files.

Verify that 'src{/}system' resolves as intended across platforms; consider using 'src/system' if platform independence is not required.

@cesarcoatl cesarcoatl merged commit f2d4ba0 into main Aug 8, 2025
8 checks passed
@cesarcoatl cesarcoatl deleted the build/deps/flake8-pydoclint branch August 8, 2025 05:34
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.

2 participants