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 @@
1exclude: ^tests/ref/
2
3repos:
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 @@
1abl
2acount
3ACN
4addin
5alis
6alls
7als
8ALOG
9ALS
10anull
11ANC
12ans
13ANS
14basf
15bloc
16brane
17BREIF
18bu
19BU
20bufer
21caf
22CAF
23clen
24clens
25Collet
26compre
27dum
28endin
29erro
30fiel
31FIEL
32fils
33filp
34filterd
35FILTERD
36fle
37fo
38FPR
39fro
40Hald
41ine
42inh
43inouts
44indx
45inout
46inport
47ist
48laf
49LAF
50lastr
51LinS
52mapp
53mis
54mot
55nd
56nIn
57offsetp
58orderd
59ot
60outout
61padd
62paeth
63PAETH
64parm
65PARM
66parms
67pEvents
68PixelX
69Psot
70quater
71readd
72reencode
73Reencode
74recuse
75redY
76remaind
77renderD
78rin
79SAV
80SEH
81ser
82SER
83setts
84shft
85siz
86SIZ
87skipd
88sme
89som
90sover
91STAP
92startd
93statics
94struc
95suble
96te
97TE
98tha
99tne
100tolen
101tpye
102tre
103truns
104trun
105TRUN
106Tung
107tE
108TYE
109ue
110ues
111UES
112vai
113vas
114vor
115vie
116VILL
117wel
118wih
.forgejo/workflows/lint.yml+26−0
@@ -0,0 +1,26 @@
1on:
2 push:
3 branches:
4 - master
5 pull_request:
6
7jobs:
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