Skip to content

Commit df11f98

Browse files
committed
Add pre-commit checks
1 parent 811ac62 commit df11f98

File tree

5 files changed

+1902
-1
lines changed

5 files changed

+1902
-1
lines changed

.github/workflows/code_checks.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: code checks
2+
permissions:
3+
contents: read
4+
pull-requests: write
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- .pre-commit-config.yaml
12+
- .github/workflows/code_checks.yml
13+
- '**.py'
14+
- uv.lock
15+
- pyproject.toml
16+
- '**.ipynb'
17+
pull_request:
18+
branches:
19+
- main
20+
paths:
21+
- .pre-commit-config.yaml
22+
- .github/workflows/code_checks.yml
23+
- '**.py'
24+
- uv.lock
25+
- pyproject.toml
26+
- '**.ipynb'
27+
28+
jobs:
29+
run-code-check:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v6.0.1
33+
34+
- name: Install uv
35+
uses: astral-sh/setup-uv@v7.1.5
36+
with:
37+
# Install a specific version of uv.
38+
version: "0.9.11"
39+
enable-cache: true
40+
41+
- name: "Set up Python"
42+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
43+
with:
44+
python-version-file: ".python-version"
45+
46+
- name: Install the project
47+
run: uv sync --all-extras --dev
48+
49+
- name: Install dependencies and check code
50+
run: |
51+
source .venv/bin/activate
52+
pre-commit run --all-files
53+
54+
- name: pip-audit (gh-action-pip-audit)
55+
uses: pypa/gh-action-pip-audit@v1.1.0
56+
with:
57+
virtual-environment: .venv/
58+
ignore-vulns: |
59+
GHSA-4xh5-x5gv-qwph

.pre-commit-config.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0 # Use the ref you want to point at
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-ast
7+
- id: check-builtin-literals
8+
- id: check-docstring-first
9+
- id: check-executables-have-shebangs
10+
- id: debug-statements
11+
- id: end-of-file-fixer
12+
- id: mixed-line-ending
13+
args: [--fix=lf]
14+
- id: check-byte-order-marker
15+
- id: check-merge-conflict
16+
- id: check-symlinks
17+
- id: detect-private-key
18+
- id: check-yaml
19+
args: [--unsafe]
20+
- id: check-toml
21+
22+
- repo: https://github.com/astral-sh/uv-pre-commit
23+
rev: 0.6.13
24+
hooks:
25+
- id: uv-lock
26+
27+
- repo: https://github.com/astral-sh/ruff-pre-commit
28+
rev: 'v0.11.4'
29+
hooks:
30+
- id: ruff
31+
args: [--fix, --exit-non-zero-on-fix]
32+
types_or: [python, jupyter]
33+
- id: ruff-format
34+
types_or: [python, jupyter]
35+
36+
- repo: https://github.com/crate-ci/typos
37+
rev: v1 # v1.19.0
38+
hooks:
39+
- id: typos
40+
args: []
41+
42+
ci:
43+
autofix_commit_msg: |
44+
[pre-commit.ci] Add auto fixes from pre-commit.com hooks
45+
46+
for more information, see https://pre-commit.ci
47+
autofix_prs: true
48+
autoupdate_branch: ''
49+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
50+
autoupdate_schedule: weekly
51+
submodules: false

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ plugins:
4747
show_symbol_type_toc: true
4848
repo_url: https://github.com/VectorInstitute/aieng-bot-maintain
4949
repo_name: VectorInstitute/aieng-bot-maintain
50-
site_name: AI Engineering Maintainance Bot
50+
site_name: AI Engineering Maintenance Bot
5151
theme:
5252
custom_dir: docs/overrides
5353
favicon: assets/favicon-48x48.svg

pyproject.toml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
[project]
2+
name = "aieng-bot-maintain"
3+
version = "0.1.0"
4+
description = "Vector Institute AI Engineering Bot for Maintenance Tasks"
5+
readme = "README.md"
6+
authors = [ {name = "Vector AI Engineering", email = "ai_engineering@vectorinstitute.ai"}]
7+
license = "Apache-2.0"
8+
repository = "https://github.com/VectorInstitute/aieng-bot-maintain"
9+
requires-python = ">=3.12"
10+
dependencies = [
11+
"pyyaml>=6.0.2",
12+
]
13+
14+
[dependency-groups]
15+
dev = [
16+
"codecov>=2.1.13",
17+
"mypy>=1.14.1",
18+
"nbqa>=1.9.1",
19+
"pip>=25.2", # Pinning version to address vulnerability GHSA-4xh5-x5gv-qwph
20+
"pip-audit>=2.7.3",
21+
"pre-commit>=4.1.0",
22+
"pytest>=8.3.4",
23+
"pytest-asyncio>=0.25.2",
24+
"pytest-cov>=6.0.0",
25+
"pytest-mock>=3.14.0",
26+
"ruff>=0.13.3",
27+
]
28+
29+
docs = [
30+
"jinja2>=3.1.6", # Pinning version to address vulnerability GHSA-cpwx-vrp4-4pq7
31+
"mkdocs>=1.6.0",
32+
"mkdocs-material>=9.5.15",
33+
"mkdocstrings>=0.24.1",
34+
"mkdocstrings-python>=1.10.0",
35+
"ipykernel>=6.29.5",
36+
"ipython>=8.31.0",
37+
]
38+
39+
[tool.ruff]
40+
include = ["*.py", "pyproject.toml", "*.ipynb"]
41+
line-length = 88
42+
43+
[tool.ruff.format]
44+
quote-style = "double"
45+
indent-style = "space"
46+
docstring-code-format = true
47+
48+
[tool.ruff.lint]
49+
select = [
50+
"A", # flake8-builtins
51+
"B", # flake8-bugbear
52+
"COM", # flake8-commas
53+
"C4", # flake8-comprehensions
54+
"RET", # flake8-return
55+
"SIM", # flake8-simplify
56+
"ICN", # flake8-import-conventions
57+
"Q", # flake8-quotes
58+
"RSE", # flake8-raise
59+
"D", # pydocstyle
60+
"E", # pycodestyle
61+
"F", # pyflakes
62+
"I", # isort
63+
"W", # pycodestyle
64+
"N", # pep8-naming
65+
"ERA", # eradicate
66+
"PL", # pylint
67+
]
68+
fixable = ["A", "B", "COM", "C4", "RET", "SIM", "ICN", "Q", "RSE", "D", "E", "F", "I", "W", "N", "ERA", "PL"]
69+
ignore = [
70+
"B905", # `zip()` without an explicit `strict=` parameter
71+
"E501", # line too long
72+
"D203", # 1 blank line required before class docstring
73+
"D213", # Multi-line docstring summary should start at the second line
74+
"PLR2004", # Replace magic number with named constant
75+
"PLR0913", # Too many arguments
76+
"COM812", # Missing trailing comma
77+
]

0 commit comments

Comments
 (0)