mirror of
https://github.com/trailbaseio/trailbase
synced 2026-04-21 13:37:44 +00:00
173 lines
4.9 KiB
YAML
173 lines
4.9 KiB
YAML
exclude: '(trailbase-core/bindings|bindings)/.*'
|
|
|
|
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.6.0
|
|
hooks:
|
|
- id: check-byte-order-marker
|
|
- id: check-case-conflict
|
|
- id: check-merge-conflict
|
|
- id: check-symlinks
|
|
- id: check-yaml
|
|
- id: end-of-file-fixer
|
|
- id: mixed-line-ending
|
|
- id: trailing-whitespace
|
|
|
|
# Self-validation for pre-commit manifest.
|
|
- repo: https://github.com/pre-commit/pre-commit
|
|
rev: v3.8.0
|
|
hooks:
|
|
- id: validate_manifest
|
|
|
|
- repo: local
|
|
hooks:
|
|
### Rust ###
|
|
- id: cargofmt
|
|
name: Cargo Format
|
|
entry: cargo fmt -- --check
|
|
pass_filenames: false
|
|
# NOTE: language refers to the language in which the hook is implemented
|
|
# in, rather than the inputs. In this case we rely on cargo being
|
|
# installed on the system
|
|
language: system
|
|
# NOTE: types/files/exclude narrow the inputs the hook should run on.
|
|
types: [rust]
|
|
exclude: '^vendor/'
|
|
|
|
- id: cargoclippy
|
|
name: Cargo Clippy
|
|
# Be verbose to at least still see warnings scroll by.
|
|
verbose: true
|
|
entry: cargo clippy --workspace --no-deps
|
|
language: system
|
|
types: [rust]
|
|
exclude: '^vendor/'
|
|
pass_filenames: false
|
|
|
|
- id: cargotest
|
|
name: Cargo Test
|
|
entry: cargo test --workspace -- --show-output
|
|
language: system
|
|
types: [rust]
|
|
exclude: '^(vendor|bindings)/'
|
|
pass_filenames: false
|
|
|
|
### JS/TypeScript: Cient, Admin UI, Auth UI, Docs, examples ... ###
|
|
- id: prettier
|
|
name: Prettier
|
|
entry: pnpm -r format --check
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(js|mjs|cjs|ts|jsx|tsx|astro|md|mdx)$
|
|
pass_filenames: false
|
|
|
|
- id: typescript_check
|
|
name: Typescript Check
|
|
entry: pnpm -r check
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(js|mjs|cjs|ts|jsx|tsx|astro|mdx)$
|
|
pass_filenames: false
|
|
|
|
- id: javascript_test
|
|
name: JavaScript Test
|
|
entry: pnpm -r test
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(js|mjs|cjs|ts|jsx|tsx|astro)$
|
|
pass_filenames: false
|
|
|
|
- id: build_website
|
|
name: Build Website
|
|
entry: sh -c 'cd docs && pnpm build'
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(js|mjs|cjs|ts|jsx|tsx|astro)$
|
|
pass_filenames: false
|
|
|
|
### Dart: client and example
|
|
- id: dart_format
|
|
name: Dart format
|
|
entry: dart format -o none --set-exit-if-changed client/trailbase-dart examples/blog/flutter
|
|
language: system
|
|
types: [file]
|
|
files: .*\.dart$
|
|
pass_filenames: false
|
|
|
|
- id: dart_analyze
|
|
name: Dart analyze
|
|
entry: sh -c 'dart pub -C client/trailbase-dart get && dart pub -C examples/blog/flutter get && dart analyze -- client/trailbase-dart examples/blog/flutter'
|
|
language: system
|
|
types: [file]
|
|
files: .*\.dart$
|
|
pass_filenames: false
|
|
|
|
- id: dart_test
|
|
name: Dart test
|
|
entry: sh -c 'cd client/trailbase-dart && dart pub get && dart test'
|
|
language: system
|
|
types: [file]
|
|
files: .*\.dart$
|
|
pass_filenames: false
|
|
|
|
### Dotnet client
|
|
- id: dotnet_format
|
|
name: Dotnet format
|
|
entry: sh -c 'dotnet format client/trailbase-dotnet/src --verify-no-changes && dotnet format client/trailbase-dotnet/test --verify-no-changes'
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(cs|csproj)$
|
|
pass_filenames: false
|
|
|
|
- id: dotnet_test
|
|
name: Dotnet test
|
|
entry: dotnet test client/trailbase-dotnet/test
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(cs|csproj)$
|
|
pass_filenames: false
|
|
|
|
### Python client
|
|
- id: python_format
|
|
name: Python format
|
|
entry: poetry -C client/trailbase-py run black --config pyproject.toml --check .
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(py)$
|
|
pass_filenames: false
|
|
|
|
- id: python_check
|
|
name: Python check
|
|
entry: poetry -C client/trailbase-py run pyright --outputjson
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(py)$
|
|
pass_filenames: false
|
|
|
|
- id: python_test
|
|
name: Python test
|
|
entry: poetry -C client/trailbase-py run pytest
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(py)$
|
|
pass_filenames: false
|
|
|
|
### Swift client
|
|
- id: swift_format
|
|
name: Swift format
|
|
# NOTE: `swift-format` always exits with code 0, meaning we depend on
|
|
# "--in-place" and the pre-commit framework's "Post Run" hook to fail
|
|
# if files were altered.
|
|
entry: swift-format format -r --in-place client/trailbase-swift/**/*.swift
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(swift)$
|
|
pass_filenames: false
|
|
|
|
- id: swift_test
|
|
name: Swift test
|
|
entry: swift test --package-path client/trailbase-swift
|
|
language: system
|
|
types: [file]
|
|
files: .*\.(swift)$
|
|
pass_filenames: false
|