Skip to content

CI: add pre-commit config - #172

Open
sweetytweety2406-wq wants to merge 1 commit into
OpenAgentHQ:mainfrom
sweetytweety2406-wq:ci/add-pre-commit-config
Open

CI: add pre-commit config#172
sweetytweety2406-wq wants to merge 1 commit into
OpenAgentHQ:mainfrom
sweetytweety2406-wq:ci/add-pre-commit-config

Conversation

@sweetytweety2406-wq

Copy link
Copy Markdown

Summary

Adds a pre-commit configuration to provide local quality checks consistent with the project's CI. Also documents how to install and use pre-commit.

Changes

  • Added .pre-commit-config.yaml
  • Configured Ruff, MyPy, and Bandit pre-commit hooks
  • Updated Development.md with pre-commit installation and usage instructions
  • Fixed a typing issue in src/modeldock/adapters/registry/bundled.py required for MyPy to pass

Testing

  • Ran pre-commit run --all-files
  • Verified:
    • ✅ Ruff
    • ✅ Ruff Format
    • ✅ MyPy
    • ✅ Bandit

Checklist

  • Branch named per Git Workflow (feature/, fix/, docs/, refactor/, test/, chore/)
  • Not developed on main
  • Code follows AGENT.md coding standards (type hints, Pydantic v2, no generic Exception, no business logic in CLI)
  • domain/ and ports/ stay pure (no I/O, no framework imports)
  • Quality gates pass locally: ruff, mypy --strict, bandit, pytest
  • Docs updated if behavior changed
  • pyproject.toml and src/modeldock/__init__.py versions match (if release-related)

Closes #135

Copilot AI left a comment

Copy link
Copy Markdown

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 adds a pre-commit configuration and updates developer documentation so contributors can run the same quality checks locally that CI runs (lint/format, type-checking, and security scanning), addressing issue #135.

Changes:

  • Added a new .pre-commit-config.yaml defining Ruff, MyPy, and Bandit hooks.
  • Documented how to install and run pre-commit hooks in Development.md.
  • Adjusted a type assertion in the bundled registry adapter to satisfy MyPy.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.pre-commit-config.yaml Introduces local pre-commit hooks intended to mirror CI quality gates.
Development.md Documents pre-commit installation and usage for local workflows.
src/modeldock/adapters/registry/bundled.py Adds an explicit cast(...) around ModelSpec.model_validate(...) for type-checking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .pre-commit-config.yaml
Comment on lines +2 to +4
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.7
hooks:
Comment thread .pre-commit-config.yaml
Comment on lines +11 to +16
- id: mypy
files: ^src/
args:
- --ignore-missing-imports
- --allow-untyped-decorators
- --disable-error-code=misc
@sweetytweety2406-wq

Copy link
Copy Markdown
Author

@himanshu231204 I removed the cast() based on the CI feedback, but my local pre-commit now reports Returning Any from function declared to return "ModelSpec" on the same line. Since the project uses strict MyPy settings and CI previously reported the cast as redundant, could you clarify the expected approach here? I'm happy to update the PR accordingly.

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.

CI: add pre-commit config

2 participants