Enable pre-commit

Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>
This commit is contained in:
Suguru Hirahara 2025-06-02 20:54:10 +09:00 committed by Slavi Pantaleev
parent cb7db82fe9
commit 17e14a4b89
16 changed files with 53 additions and 34 deletions

2
.codespellrc Normal file
View File

@ -0,0 +1,2 @@
[codespell]
ignore-words-list = aNULL,brose,doub,Udo,re-use,re-used

View File

@ -28,5 +28,8 @@
],
"ignoreDeps": [
"ghcr.io/matrixgpt/matrix-chatgpt-bot"
]
],
"pre-commit": {
"enabled": true
}
}

View File

@ -7,9 +7,7 @@
---
name: Matrix CI
on: # yamllint disable-line rule:truthy
push:
pull_request:
on: [push, pull_request] # yamllint disable-line rule:truthy
jobs:
yamllint:
@ -30,3 +28,11 @@ jobs:
uses: ansible-community/ansible-lint-action@v6.17.0
with:
path: roles/custom
precommit:
name: Run pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run pre-commit
uses: pre-commit/action@v3.0.1

View File

@ -1,20 +0,0 @@
# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# SPDX-License-Identifier: CC0-1.0
---
name: REUSE Compliance Check
on: [push, pull_request] # yamllint disable-line rule:truthy
permissions:
contents: read
jobs:
reuse-compliance-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v5

26
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,26 @@
---
default_install_hook_types: [pre-push]
exclude: "LICENSES/"
# See: https://pre-commit.com/hooks.html
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# - id: check-executables-have-shebangs
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-toml
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args: ["--skip=*.po,*.pot,i18n/"]
- repo: https://github.com/fsfe/reuse-tool # https://reuse.software/dev/#pre-commit-hook
rev: v5.0.2
hooks:
- id: reuse

View File

@ -13,10 +13,12 @@ path = [
"i18n/PUBLISHED_LANGUAGES",
"i18n/requirements.txt",
"roles/custom/**/*.repo",
".codespellrc",
".editorconfig",
".envrc",
".gitattributes",
".gitignore",
".pre-commit-config.yaml",
".yamllint",
"ansible.cfg",
"flake.lock",