Skip to content

Commit

Permalink
Create a pre-commit configuration and run it in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
eliericha committed Nov 29, 2024
1 parent e059a67 commit ef67726
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
# This is intented for compatibility with Black. See
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
max-line-length = 80
extend-select = B950
extend-ignore = E203,E501,E701
6 changes: 6 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ include:
# Issue check
- component: $CI_SERVER_FQDN/eng/gitlab-templates/check-issue@~latest

# pre-commit
- component: $CI_SERVER_FQDN/eng/gitlab-templates/pre-commit@~latest
inputs:
on-diff: true
stage: check

# Build
- component: $CI_SERVER_FQDN/eng/gitlab-templates/build@~latest
inputs:
Expand Down
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
repos:
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
types: [file]
files: \.(py|anod|plan)$
additional_dependencies:
- flake8-bugbear
- flake8-builtins
- flake8-comprehensions
# - flake8-docstrings
# - flake8-rst-docstrings
- repo: https://github.com/ambv/black
rev: 24.2.0
hooks:
- id: black
types_or: [file]
files: \.(py|plan)$
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
files: '\.py$'
# exclude: "^tests/.+$"
additional_dependencies:
- --extra-index-url
- https://gitlab.adacore-it.com/api/v4/projects/it%2Fpackage-registry/packages/pypi/simple
- pytest-lsp

0 comments on commit ef67726

Please sign in to comment.