History

forgejo/workflows: add pre-commit based linting

Timo Rothenpieler committed 1 year ago

Commit 16d663d1 parent 262d41c3 files · +167 −0Browse files

Unified · Split

3 files
  1. .forgejo/pre-commit/config.yaml +23 −0
  2. .forgejo/pre-commit/ignored-words.txt +118 −0
  3. .forgejo/workflows/lint.yml +26 −0
.forgejo/pre-commit/config.yaml+23−0
@@ -0,0 +1,23 @@
1+exclude: ^tests/ref/
2+
3+repos:
4+- repo: https://github.com/pre-commit/pre-commit-hooks
5+ rev: v5.0.0
6+ hooks:
7+ - id: check-case-conflict
8+ - id: check-executables-have-shebangs
9+ - id: check-illegal-windows-names
10+ - id: check-shebang-scripts-are-executable
11+ - id: check-yaml
12+ - id: end-of-file-fixer
13+ - id: fix-byte-order-marker
14+ - id: mixed-line-ending
15+ - id: trailing-whitespace
16+- repo: https://github.com/codespell-project/codespell
17+ rev: v2.4.1
18+ hooks:
19+ - id: codespell
20+ args:
21+ - --ignore-words=.forgejo/pre-commit/ignored-words.txt
22+ - --ignore-multiline-regex=codespell:off.*?(codespell:on|\Z)
23+ exclude: ^tools/(patcheck|clean-diff)$
.forgejo/pre-commit/ignored-words.txt+118−0
@@ -0,0 +1,118 @@
1+abl
2+acount
3+ACN
4+addin
5+alis
6+alls
7+als
8+ALOG
9+ALS
10+anull
11+ANC
12+ans
13+ANS
14+basf
15+bloc
16+brane
17+BREIF
18+bu
19+BU
20+bufer
21+caf
22+CAF
23+clen
24+clens
25+Collet
26+compre
27+dum
28+endin
29+erro
30+fiel
31+FIEL
32+fils
33+filp
34+filterd
35+FILTERD
36+fle
37+fo
38+FPR
39+fro
40+Hald
41+ine
42+inh
43+inouts
44+indx
45+inout
46+inport
47+ist
48+laf
49+LAF
50+lastr
51+LinS
52+mapp
53+mis
54+mot
55+nd
56+nIn
57+offsetp
58+orderd
59+ot
60+outout
61+padd
62+paeth
63+PAETH
64+parm
65+PARM
66+parms
67+pEvents
68+PixelX
69+Psot
70+quater
71+readd
72+reencode
73+Reencode
74+recuse
75+redY
76+remaind
77+renderD
78+rin
79+SAV
80+SEH
81+ser
82+SER
83+setts
84+shft
85+siz
86+SIZ
87+skipd
88+sme
89+som
90+sover
91+STAP
92+startd
93+statics
94+struc
95+suble
96+te
97+TE
98+tha
99+tne
100+tolen
101+tpye
102+tre
103+truns
104+trun
105+TRUN
106+Tung
107+tE
108+TYE
109+ue
110+ues
111+UES
112+vai
113+vas
114+vor
115+vie
116+VILL
117+wel
118+wih
.forgejo/workflows/lint.yml+26−0
@@ -0,0 +1,26 @@
1+on:
2+ push:
3+ branches:
4+ - master
5+ pull_request:
6+
7+jobs:
8+ lint:
9+ runs-on: utilities
10+ steps:
11+ - name: Checkout
12+ uses: actions/checkout@v4
13+ - name: Install pre-commit CI
14+ id: install
15+ run: |
16+ python3 -m venv ~/pre-commit
17+ ~/pre-commit/bin/pip install --upgrade pip setuptools
18+ ~/pre-commit/bin/pip install pre-commit
19+ echo "envhash=$({ python3 --version && cat .forgejo/pre-commit/config.yaml; } | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
20+ - name: Cache
21+ uses: actions/cache@v4
22+ with:
23+ path: ~/.cache/pre-commit
24+ key: pre-commit-${{ steps.install.outputs.envhash }}
25+ - name: Run pre-commit CI
26+ run: ~/pre-commit/bin/pre-commit run -c .forgejo/pre-commit/config.yaml --show-diff-on-failure --color=always --all-files

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t