Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
130 lines (130 loc) · 7.62 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
130 lines (130 loc) · 7.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# installer/translations/inno/ is vendored verbatim from issrc by
# update_from_inno.py; reformatting it would make every re-fetch a diff.
# Patches apply verbatim, and a `-- ` signature line ends in whitespace.
# `build/` matches a whole path segment: unanchored it also swallowed the hand-written
# sources in the kolibri-build package and the h5p_viewer h5p_build scripts.
exclude: (\.git/|\.tox/|\.venv/|(^|/)build/|static/(?!assets/fonts)|dist/|node_modules/|kolibripip\.pex|platforms/desktop-app/installer/translations/inno/|\.patch$)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: check-yaml
exclude: '^(pnpm-lock\.yaml|platforms/android/\.maestro/.*\.ya?ml)$'
- id: check-yaml
# Maestro flows (platforms/android/.maestro/*.yaml) are multi-document
# YAML — an appId config document followed by the flow steps document.
# Scope the relaxation here so the rest of the repo stays single-document.
name: check-yaml (multi-document Maestro flows)
args: [--allow-multiple-documents]
files: '^platforms/android/\.maestro/.*\.ya?ml$'
- id: check-added-large-files
exclude: '^(pnpm-lock\.yaml|uv\.lock)$'
- id: debug-statements
- id: end-of-file-fixer
exclude: '^.+?(\.json|\.po)$'
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.13.6
hooks:
- id: uv-lock
- repo: https://github.com/google/yamlfmt
rev: v0.21.0
hooks:
- id: yamlfmt
exclude: '^pnpm-lock\.yaml$'
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.31.1
hooks:
- id: zizmor
args: [--no-progress, --offline, --min-confidence, medium]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.17.3
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.4.1
hooks:
- id: mypy
files: ^platforms/flatpak-app/
# From the repo root, imports resolve into kolibri/, which is not typed.
args: [--ignore-missing-imports, --follow-imports=silent]
- repo: https://github.com/sqlfluff/sqlfluff
rev: 4.5.0
hooks:
- id: sqlfluff-fix
# The SQL in the tree is generated DDL, so reformat it and nothing else.
args: [--rules, layout]
- repo: local
hooks:
- id: lint-frontend
name: Linting of JS, Vue, SCSS and CSS files
description: This hook handles all frontend linting for Kolibri
entry: pnpm run lint-frontend:format
language: system
files: \.(js|vue|scss|css)$
exclude: (?x)^(kolibri/plugins/qti_viewer/frontend/components/__fixtures__/items\.js|packages/eslint-plugin-kolibri/tests/lib/rules/fixtures/malformed\.js)
- repo: local
hooks:
- id: core-js-api
name: Rebuild kolibri package
description: Rebuilds kolibri package on changes to core js api
entry: pnpm exec node ./packages/build_kolibri_package.js
language: system
files: ^packages/kolibri/.*\.(js|vue)$
require_serial: true
- repo: local
hooks:
- id: perseus-translator
name: Regenerate Perseus translator
description: Regenerates the Perseus viewer's translator.js from the installed Perseus strings
entry: pnpm --filter kolibri-perseus-viewer build-perseus
language: system
pass_filenames: false
files: ^kolibri/plugins/perseus_viewer/(package\.json|buildPerseus\.js|extractPerseusMessages\.js|frontend/(translator|translationUtils)\.js)$
require_serial: true
- repo: local
hooks:
- id: no-auto-migrations
name: no auto-named migrations
entry: We do not allow _auto_ in migration names. Please give the migration a telling name.
language: fail
files: .*/migrations/.*_auto_.*\.py$
exclude: (?x)^( kolibri/core/auth/migrations/0002_auto_20170608_2125\.py| kolibri/core/auth/migrations/0003_auto_20170621_0958\.py| kolibri/core/auth/migrations/0004_auto_20170816_1607\.py| kolibri/core/auth/migrations/0005_auto_20170818_1203\.py| kolibri/core/auth/migrations/0006_auto_20171206_1207\.py| kolibri/core/auth/migrations/0007_auto_20171226_1125\.py| kolibri/core/auth/migrations/0008_auto_20180222_1244\.py| kolibri/core/auth/migrations/0009_auto_20180301_1123\.py| kolibri/core/auth/migrations/0010_auto_20180320_1320\.py| kolibri/core/auth/migrations/0013_auto_20180917_1213\.py| kolibri/core/auth/migrations/0014_auto_20190815_1421\.py| kolibri/core/content/migrations/0003_auto_20170607_1212\.py| kolibri/core/content/migrations/0004_auto_20170825_1038\.py| kolibri/core/content/migrations/0005_auto_20171009_0903\.py| kolibri/core/content/migrations/0006_auto_20171128_1703\.py| kolibri/core/content/migrations/0007_auto_20180212_1155\.py| kolibri/core/content/migrations/0008_auto_20180429_1709\.py| kolibri/core/content/migrations/0009_auto_20180410_1139\.py| kolibri/core/content/migrations/0011_auto_20180907_1017\.py| kolibri/core/content/migrations/0012_auto_20180910_1702\.py| kolibri/core/content/migrations/0013_auto_20180919_1142\.py| kolibri/core/content/migrations/0014_auto_20181218_1132\.py| kolibri/core/content/migrations/0015_auto_20190125_1715\.py| kolibri/core/content/migrations/0016_auto_20190124_1639\.py| kolibri/core/content/migrations/0017_auto_20190415_1855\.py| kolibri/core/device/migrations/0004_auto_20190306_0553\.py| kolibri/core/device/migrations/0005_auto_20191203_0951\.py| kolibri/core/exams/migrations/0003_auto_20190426_1015\.py| kolibri/core/lessons/migrations/0002_auto_20180221_1115\.py| kolibri/core/logger/migrations/0002_auto_20170518_1031\.py| kolibri/core/logger/migrations/0003_auto_20170531_1140\.py| kolibri/core/logger/migrations/0005_auto_20180514_1419\.py| )$
- id: no-swappable-auth-migrations
name: No migrations with swappable auth models (settings.AUTH_USER_MODEL)
entry: settings\.AUTH_USER_MODEL
language: pygrep
files: migrations/.*\.py$
- id: check-published-deps
name: No published package depends on or imports an unpublished one
description: Either resolves to a version that was never uploaded, so the published tarball 404s for consumers
entry: python .pre-commit-hooks/check_published_deps.py
language: python
pass_filenames: false
files: ^packages/([^/]+/package\.json|.*\.(js|vue))$
- id: sync-scaffold-versions
name: Sync plugin scaffolder fallback version pins
description: Keeps FRONTEND_DEPENDENCIES pins in manifest.py in sync with the pnpm workspace/catalog versions
entry: python .pre-commit-hooks/sync_scaffold_versions.py
language: system
pass_filenames: false
files: ^(pnpm-workspace\.yaml|packages/[^/]+/package\.json|kolibri/utils/plugin_scaffold/manifest\.py)$
- id: check-lfs-pointers
name: Check LFS files are pointers not binary data
description: Prevents accidentally committing binary files that should be LFS pointers (issue #7099)
entry: python .pre-commit-hooks/check_lfs_pointers.py
language: system
- id: check-workflow-permissions
name: Reusable workflow callers grant the permissions their callees request
description: A mismatch aborts the whole run at load time with startup_failure, before any job starts
entry: python .pre-commit-hooks/check_workflow_permissions.py
language: python
additional_dependencies: [PyYAML]
pass_filenames: false
files: ^\.github/workflows/.*\.ya?ml$