Skip to content

Commit 8d0467a

Browse files
committed
pre-commit and gh action
1 parent 871ef62 commit 8d0467a

File tree

2 files changed

+89
-12
lines changed

2 files changed

+89
-12
lines changed
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# deactivated, since GitHub Action's Ubuntu uses an older version than homebrew :-(
2-
31
name: Check Code
42

53
on:
@@ -18,12 +16,18 @@ jobs:
1816

1917
steps:
2018
- name: Checkout repository
21-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
20+
with:
21+
persist-credentials: false
22+
fetch-depth: 0 # 0 if you want to push to repo
2223

23-
# - name: Python set up
24-
# uses: actions/setup-python@v4
25-
# with:
26-
# python-version: "3.10"
24+
- name: gitleaks
25+
uses: gitleaks/gitleaks-action@v2
26+
27+
- name: Python set up
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.13"
2731

2832
# - name: Python cache set up
2933
# uses: actions/cache@v3
@@ -36,8 +40,10 @@ jobs:
3640
# python -m pip install --upgrade pip
3741
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3842

39-
- name: install apt packages
40-
run: |
41-
sudo apt-get install -y perltidy
42-
- name: Run pre-commit tests
43-
uses: pre-commit/action@v3.0.0
43+
# - name: install apt packages
44+
# run: |
45+
# sudo apt-get install -y perltidy
46+
47+
# could not fix the issue
48+
# - name: Run pre-commit tests
49+
# uses: pre-commit/action@v3.0.0

.pre-commit-config.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# install package
2+
# pip3 install pre-commit
3+
# register as git commit-hook to run automatically
4+
# pre-commit install
5+
# run manually
6+
# pre-commit run --all-files
7+
# update hooks to latest version
8+
# pre-commit autoupdate
9+
10+
default_language_version:
11+
python: python3.13
12+
13+
exclude: |
14+
(?x)^(
15+
\.vscode/.*
16+
)$
17+
18+
repos:
19+
- repo: https://github.com/pre-commit/pre-commit-hooks
20+
rev: v5.0.0
21+
hooks:
22+
- id: check-added-large-files
23+
args: ["--maxkb=500"]
24+
- id: check-ast
25+
- id: check-builtin-literals
26+
- id: check-case-conflict
27+
- id: check-docstring-first
28+
- id: check-executables-have-shebangs
29+
# - id: check-illegal-windows-names
30+
- id: check-json
31+
- id: check-merge-conflict
32+
- id: check-shebang-scripts-are-executable
33+
- id: check-symlinks
34+
- id: check-toml
35+
- id: check-vcs-permalinks
36+
- id: check-xml
37+
- id: check-yaml
38+
- id: debug-statements
39+
- id: destroyed-symlinks
40+
# - id: detect-aws-credentials
41+
- id: detect-private-key
42+
# conflict with black below
43+
# - id: double-quote-string-fixer
44+
- id: end-of-file-fixer
45+
# - id: file-contents-sorter
46+
# files: ^(deploy-whitelist.txt|\.gitignore|\.dockerignore)$
47+
- id: fix-byte-order-marker
48+
- id: fix-encoding-pragma
49+
args: ["--remove"]
50+
- id: forbid-new-submodules
51+
# - id: forbid-submodules
52+
- id: mixed-line-ending
53+
args: ["--fix=lf"]
54+
- id: name-tests-test
55+
args: ["--pytest-test-first"]
56+
# - id: no-commit-to-branch
57+
# args: [--branch, staging]
58+
- id: pretty-format-json
59+
args: ["--autofix", "--no-ensure-ascii", "--no-sort-keys"]
60+
- id: requirements-txt-fixer
61+
# - id: sort-simple-yaml
62+
# files: ^config/simple/
63+
- id: trailing-whitespace
64+
65+
# Perl
66+
- repo: https://github.com/henryykt/pre-commit-perl
67+
rev: v0.0.5
68+
hooks:
69+
# - id: perlcritic
70+
- id: perltidy
71+
# - id: perlimports

0 commit comments

Comments
 (0)