-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add code quality toolchain (ruff, mypy, pre-commit, dependabot) #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| version: 2 | ||
|
|
||
| updates: | ||
| - package-ecosystem: uv | ||
| directory: / | ||
| schedule: | ||
| interval: daily | ||
| time: "06:00" | ||
| timezone: Etc/UTC | ||
| groups: | ||
| minor-and-patch: | ||
| update-types: [minor, patch] | ||
| reviewers: | ||
| - Aureliolo | ||
| labels: | ||
| - type:chore | ||
|
|
||
| - package-ecosystem: github-actions | ||
| directory: / | ||
| schedule: | ||
| interval: daily | ||
| time: "06:00" | ||
| timezone: Etc/UTC | ||
| groups: | ||
| minor-and-patch: | ||
| update-types: [minor, patch] | ||
| reviewers: | ||
| - Aureliolo | ||
| labels: | ||
| - type:ci |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| ci: | ||
| autoupdate_schedule: weekly | ||
| autofix_prs: true | ||
| autofix_commit_msg: "style: auto-fix pre-commit hooks" | ||
| autoupdate_commit_msg: "chore: update pre-commit hooks" | ||
| skip: [commitizen, gitleaks] | ||
|
|
||
| default_install_hook_types: [pre-commit, commit-msg] | ||
|
|
||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: trailing-whitespace | ||
| - id: end-of-file-fixer | ||
| - id: check-yaml | ||
| - id: check-toml | ||
| - id: check-json | ||
| - id: check-merge-conflict | ||
| - id: check-added-large-files | ||
| args: [--maxkb=1024] | ||
| - id: no-commit-to-branch | ||
| args: [--branch, main] | ||
|
|
||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.15.4 | ||
| hooks: | ||
| - id: ruff | ||
| args: [--fix] | ||
| - id: ruff-format | ||
|
|
||
| - repo: https://github.com/gitleaks/gitleaks | ||
| rev: v8.24.3 | ||
| hooks: | ||
| - id: gitleaks | ||
|
|
||
| - repo: https://github.com/commitizen-tools/commitizen | ||
| rev: v4.13.9 | ||
| hooks: | ||
| - id: commitizen | ||
| stages: [commit-msg] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,121 @@ path = "src/ai_company/__init__.py" | |
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["src/ai_company"] | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "commitizen>=4.13.9", | ||
| "mypy>=1.19.1", | ||
| "pre-commit>=4.5.1", | ||
| "pre-commit-uv>=4.2.1", | ||
| "pydantic>=2.12.5", | ||
| "ruff>=0.15.4", | ||
| ] | ||
|
Comment on lines
+27
to
+35
|
||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Ruff — linter + formatter (replaces flake8, isort, pyupgrade, etc.) | ||
| # --------------------------------------------------------------------------- | ||
| [tool.ruff] | ||
| target-version = "py314" | ||
| line-length = 88 | ||
| src = ["src", "tests"] | ||
|
|
||
| [tool.ruff.lint] | ||
| select = [ | ||
| "F", # pyflakes | ||
| "E", "W", # pycodestyle | ||
| "C90", # mccabe complexity | ||
| "I", # isort | ||
| "N", # pep8-naming | ||
| "UP", # pyupgrade | ||
| "B", # flake8-bugbear | ||
| "A", # flake8-builtins | ||
| "C4", # flake8-comprehensions | ||
| "DTZ", # flake8-datetimez | ||
| "T10", # flake8-debugger | ||
| "EM", # flake8-errmsg | ||
| "ISC", # flake8-implicit-str-concat | ||
| "ICN", # flake8-import-conventions | ||
| "LOG", # flake8-logging | ||
| "PIE", # flake8-pie | ||
| "T20", # flake8-print | ||
| "PT", # flake8-pytest-style | ||
| "Q", # flake8-quotes | ||
| "RSE", # flake8-raise | ||
| "RET", # flake8-return | ||
| "SLF", # flake8-self | ||
| "SIM", # flake8-simplify | ||
| "TID", # flake8-tidy-imports | ||
| "TCH", # flake8-type-checking | ||
| "ARG", # flake8-unused-arguments | ||
| "PTH", # flake8-use-pathlib | ||
| "PERF", # perflint | ||
| "FURB", # refurb | ||
| "RUF", # ruff-specific rules | ||
| "S", # flake8-bandit (security) | ||
| "FAST", # fastapi | ||
| "ASYNC", # flake8-async | ||
| "FBT", # flake8-boolean-trap | ||
| "PL", # pylint | ||
| "TRY", # tryceratops | ||
| "FLY", # flynt | ||
| "D", # pydocstyle | ||
| ] | ||
| ignore = [ | ||
| "D100", # missing docstring in public module | ||
| "D104", # missing docstring in public package | ||
| "D107", # missing docstring in __init__ | ||
| "ISC001", # conflicts with ruff formatter | ||
| ] | ||
|
|
||
| [tool.ruff.lint.pydocstyle] | ||
| convention = "google" | ||
|
|
||
| [tool.ruff.lint.per-file-ignores] | ||
| "tests/**/*.py" = [ | ||
| "S101", # assert allowed in tests | ||
| "ARG", # unused arguments (fixtures) | ||
| "FBT", # boolean trap (parametrize) | ||
| "D", # no docstrings required in tests | ||
| "PLR2004", # magic values in tests | ||
| "SLF001", # private member access in tests | ||
| ] | ||
| "__init__.py" = ["F401", "F403"] | ||
|
|
||
| [tool.ruff.lint.isort] | ||
| known-first-party = ["ai_company"] | ||
|
|
||
| [tool.ruff.format] | ||
| docstring-code-format = true | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # mypy — static type checker (strict mode) | ||
| # --------------------------------------------------------------------------- | ||
| [tool.mypy] | ||
| python_version = "3.14" | ||
| strict = true | ||
| warn_return_any = true | ||
| warn_unused_configs = true | ||
| plugins = ["pydantic.mypy"] | ||
|
|
||
| [[tool.mypy.overrides]] | ||
| module = "tests.*" | ||
| disallow_untyped_defs = false | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # pyright — IDE type checking only (not used in CI) | ||
| # --------------------------------------------------------------------------- | ||
| [tool.pyright] | ||
| pythonVersion = "3.14" | ||
| typeCheckingMode = "basic" | ||
| venvPath = "." | ||
| venv = ".venv" | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # commitizen — conventional commits | ||
| # --------------------------------------------------------------------------- | ||
| [tool.commitizen] | ||
| name = "cz_conventional_commits" | ||
| version = "0.1.0" | ||
| version_files = ["src/ai_company/__init__.py:__version__"] | ||
| tag_format = "v$version" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .pre-commit-config.yaml does not include mypy as a hook, even though issue #52's acceptance criteria mentions "type checking" as one of the hooks to include. Consider adding mypy to the pre-commit hooks to catch type errors before commit. This can be done by adding a hook entry like:
If the omission is intentional (e.g., because mypy is slow or should only run in CI), this should be documented.