Files
langflow/.pre-commit-config.yaml
Rico Furtado 348b1b86ce feat: Version 1.2 - comprehensive database migration guidelines using… (#10519)
* feat: Version 1.2 - comprehensive database migration guidelines using the Expand-Contract pattern

* Update src/backend/base/langflow/alembic/DB-MIGRATION-GUIDE.MD

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: Cleanup text and typos

* feat: Implement migration validation workflow and add migration validator scripts

* Update src/backend/base/langflow/alembic/migration_validator.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/backend/base/langflow/alembic/migration_validator.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/backend/base/langflow/alembic/migration_validator.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: moved the test_migrations directory to under tests

* feat: Added migration validator to pre-commit check.

* fix: improved test performance.

* fix: optimized attribute resolution in migration validator

* feat: add comprehensive tests for migration validator and guidelines

* fix: Lint is complaining about shebang declared but not being used.

* fix: Shebang reinstated.

* Update src/backend/base/langflow/alembic/DB-MIGRATION-GUIDE.MD

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update .github/workflows/migration-validation.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat: color improvments

* Update .github/workflows/migration-validation.yml

Removed

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update .github/workflows/migration-validation.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ci: Created relative paths for CI

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* [autofix.ci] apply automated fixes (attempt 3/3)

* fix: Component index json.

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* [autofix.ci] apply automated fixes (attempt 3/3)

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-24 23:09:11 +00:00

79 lines
3.1 KiB
YAML

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: end-of-file-fixer
# python, js and ts only
files: \.(py|js|ts)$
- id: mixed-line-ending
files: \.(py|js|ts)$
args:
- --fix=lf
- id: trailing-whitespace
- repo: local
hooks:
- id: ruff
name: ruff check
entry: uv run ruff check
language: system
types_or: [python, pyi]
args: [--fix]
- id: ruff-format
name: ruff format
entry: uv run ruff format
language: system
types_or: [python, pyi]
args: [--config, pyproject.toml]
- id: validate-migrations
name: Validate Alembic Migrations (Expand-Contract)
entry: python src/backend/base/langflow/alembic/migration_validator.py
language: python
files: (alembic|migrations)/versions/.*\.py$
additional_dependencies: [sqlalchemy, alembic]
pass_filenames: true
always_run: false
verbose: true
- id: check-migration-phase
name: Check Migration Phase Documentation
entry: python -c "import sys, re; content = open(sys.argv[1]).read(); sys.exit(0 if re.search(r'Phase:\s*(EXPAND|MIGRATE|CONTRACT)', content) else 1)"
language: python
files: (alembic|migrations)/versions/.*\.py$
pass_filenames: true
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]
exclude: '(^docs/|^SECURITY\.md$|src/lfx/src/lfx/_assets/component_index\.json$)'
- repo: local
hooks:
- id: local-biome-check
name: biome check
entry: bash -c 'cd src/frontend && files=("${@#src/frontend/}") && npx @biomejs/biome check --write --files-ignore-unknown=true --diagnostic-level=error "${files[@]}"' --
language: system
types: [text]
files: "^src/frontend/.*\\.(jsx?|tsx?|c(js|ts)|m(js|ts)|d\\.(ts|cts|mts)|jsonc?)$"
exclude: (^docs/|src/lfx/src/lfx/_assets/component_index\.json$)
pass_filenames: true
- id: biome-lint-no-any-staged
name: biome no-any check (staged only)
entry: bash -c 'cd src/frontend && npx @biomejs/biome lint --staged --diagnostic-level=error --no-errors-on-unmatched'
language: system
files: "^src/frontend/.*\\.(tsx?|ts)$"
exclude: (^docs/)
pass_filenames: false
- id: validate-starter-projects
name: Validate Starter Project Templates
entry: uv run python src/backend/tests/unit/template/test_starter_projects.py
language: system
files: ^src/backend/base/langflow/initial_setup/starter_projects/.*\.json$
pass_filenames: false
args: [--security-check]
- id: check-deprecated-imports
name: Check for deprecated langchain imports
entry: uv run python scripts/check_deprecated_imports.py
language: system
files: ^src/lfx/src/lfx/components/.*\.py$
pass_filenames: false