Compare commits
2 commits
9c98287a6a
...
0bb3d86ab3
Author | SHA1 | Date | |
---|---|---|---|
|
0bb3d86ab3 | ||
|
c6f2d856aa |
3 changed files with 81 additions and 43 deletions
|
@ -1,31 +1,58 @@
|
||||||
# Pre-commit hooks to run tests and ensure code is cleaned.
|
# Pre-commit hooks to run tests and ensure code is cleaned.
|
||||||
# See https://pre-commit.com for more information
|
# See https://pre-commit.com for more information
|
||||||
|
---
|
||||||
repos:
|
repos:
|
||||||
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
|
rev: v0.1.6
|
||||||
|
hooks:
|
||||||
|
- id: ruff
|
||||||
|
args: ["--fix"]
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v3.15.0
|
rev: v3.15.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: ['--keep-percent-format', '--py37-plus']
|
args: ["--keep-percent-format", "--py37-plus"]
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 23.11.0
|
rev: 23.11.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
args: ['--target-version', 'py37', '--line-length', '100']
|
args: ["--target-version", "py37", "--line-length", "100"]
|
||||||
- repo: https://github.com/PyCQA/isort
|
- repo: https://github.com/PyCQA/isort
|
||||||
rev: 5.12.0
|
rev: 5.12.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
args: ['--profile', 'black', '--line-length', '100']
|
args: ["--profile", "black", "--line-length", "100"]
|
||||||
- repo: https://github.com/PyCQA/flake8
|
- repo: https://github.com/PyCQA/flake8
|
||||||
rev: 6.1.0
|
rev: 6.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
args: ['--max-line-length=100']
|
args: ["--max-line-length=100"]
|
||||||
|
- repo: https://github.com/codespell-project/codespell
|
||||||
|
rev: v2.2.2
|
||||||
|
hooks:
|
||||||
|
- id: codespell
|
||||||
|
args:
|
||||||
|
- --ignore-words-list=exten
|
||||||
|
- --skip="./.*,*.csv,*.json,*.ini,*.subject,*.txt,*.html,*.log,*.conf"
|
||||||
|
- --quiet-level=2
|
||||||
|
- --ignore-regex=.*codespell-ignore$
|
||||||
|
#- --write-changes # Uncomment to write changes
|
||||||
|
exclude_types: [csv, json]
|
||||||
|
- repo: https://github.com/adrienverge/yamllint
|
||||||
|
rev: v1.32.0
|
||||||
|
hooks:
|
||||||
|
- id: yamllint
|
||||||
|
ignore: .github/
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: v2.7.1
|
||||||
|
hooks:
|
||||||
|
- id: prettier
|
||||||
|
args: ["--print-width", "100"]
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: pylint
|
- id: pylint
|
||||||
name: pylint
|
name: pylint
|
||||||
entry: pylint
|
entry: ./.pre-commit-pylint
|
||||||
language: system
|
language: system
|
||||||
types: [python]
|
types: [python]
|
||||||
require_serial: true
|
require_serial: true
|
||||||
|
@ -33,13 +60,5 @@ repos:
|
||||||
rev: 1.7.5
|
rev: 1.7.5
|
||||||
hooks:
|
hooks:
|
||||||
- id: bandit
|
- id: bandit
|
||||||
args: [--skip, "B101", --recursive, "mylib"]
|
args: [--skip, "B101", --recursive]
|
||||||
#- repo: local
|
|
||||||
# hooks:
|
|
||||||
# - id: pytest
|
|
||||||
# name: pytest
|
|
||||||
# entry: python3 -m pytest tests
|
|
||||||
# language: system
|
|
||||||
# types: [python]
|
|
||||||
# pass_filenames: false
|
|
||||||
minimum_pre_commit_version: 3.2.0
|
minimum_pre_commit_version: 3.2.0
|
||||||
|
|
19
.pre-commit-pylint
Executable file
19
.pre-commit-pylint
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PWD=`pwd`
|
||||||
|
|
||||||
|
if [ -d "$PWD/venv" ]
|
||||||
|
then
|
||||||
|
echo "Run pylint inside venv ($PWD/venv)..."
|
||||||
|
$PWD/venv/bin/pylint "$@"
|
||||||
|
exit $?
|
||||||
|
elif [ -e "$PWD/pyproject.toml" ]
|
||||||
|
then
|
||||||
|
echo "Run pylint using poetry..."
|
||||||
|
poetry run pylint "$@"
|
||||||
|
exit $?
|
||||||
|
else
|
||||||
|
echo "Run pylint at system scope..."
|
||||||
|
pylint "$@"
|
||||||
|
exit $?
|
||||||
|
fi
|
|
@ -1,7 +1,7 @@
|
||||||
from debian:stable-slim
|
from debian:stable-slim
|
||||||
|
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y python3-all python3-dev python3-pip python3-venv build-essential pylint git && apt-get clean && rm -fr rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y python3-all python3-dev python3-pip python3-venv build-essential pylint git && apt-get clean && rm -fr rm -rf /var/lib/apt/lists/*
|
||||||
RUN pip install pre-commit --break-system-packages
|
RUN pip install pre-commit --break-system-packages
|
||||||
RUN mkdir /tmp/src
|
RUN mkdir /tmp/src
|
||||||
COPY .pre-commit-config.yaml fake_python_module /tmp/src/
|
COPY .pre-commit-config.yaml .pre-commit-pylint fake_python_module /tmp/src/
|
||||||
RUN cd /tmp/src && git init && git add * && pre-commit autoupdate && pre-commit run --all-files && rm -fr /tmp/src
|
RUN cd /tmp/src && git init && git add * && pre-commit autoupdate && pre-commit run --all-files && rm -fr /tmp/src
|
||||||
|
|
Loading…
Reference in a new issue