Skip to content

Commit

Permalink
build: add pre-commit (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelli74 authored May 24, 2024
1 parent 46350f5 commit 4de3863
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 15 deletions.
20 changes: 5 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,24 @@
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.10-bullseye",
// Options
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*"
}
},
"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"python.formatting.provider": "black",
"python.testing.pytestArgs": [
"tests"
],
"python.testing.pytestArgs": ["tests"],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"pylint.args": [

],
"pylint.args": [],
"files.trimTrailingWhitespace": true
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"charliermarsh.ruff",
"ms-python.pylint",
Expand All @@ -42,7 +33,6 @@
]
}
},
"remoteUser": "root",
"containerUser": "vscode",
"remoteUser": "vscode",
"postAttachCommand": ["pip3 install --user -r requirements.txt"]
}
}
60 changes: 60 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: "CHANGELOG.md|.copier-answers.yml"
default_stages: [commit]

ci:
autofix_commit_msg: "chore(pre-commit.ci): auto fixes"
autoupdate_commit_msg: "chore(pre-commit.ci): pre-commit autoupdate"
autoupdate_schedule: weekly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: no-commit-to-branch
args: ["--branch", "main"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.26.0
hooks:
- id: commitizen
stages: [commit-msg]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-json
- id: check-toml
- id: check-xml
- id: check-yaml
- id: detect-private-key
- repo: https://github.com/python-poetry/poetry
rev: 1.8.0
hooks:
- id: poetry-check
args: ["--lock"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
args: ["--tab-width", "2"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
hooks:
- id: mypy
additional_dependencies: []

0 comments on commit 4de3863

Please sign in to comment.