daml/.pre-commit-config.yaml
Moisés Ackerman 53372e3795
Add pre-commit and ./fmt.sh --test checks for yarn.lock file (#18112)
* Add yarn-lock-check pre-commit check

* Invoke yarn-lock-check pre-commit check from './fmt.sh --test'

* Run yarn-lock-check when yarn.lock changes
2024-01-10 10:16:09 +01:00

67 lines
2.0 KiB
YAML

# Copyright (c) 2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: '^canton(-3x)?/'
repos:
- repo: local
hooks:
- id: hlint
name: hlint
language: system
entry: "hlint -j"
require_serial: true
types: [haskell]
- id: scalafmt
name: scalafmt
language: system
require_serial: true
entry: "scalafmt --respect-project-filters"
types: [scala]
- id: javafmt
name: javafmt
language: system
require_serial: true
entry: "javafmt --set-exit-if-changed --replace"
types: [java]
- id: buildifier
name: buildifier
language: system
require_serial: true
entry: "bazel run //:buildifier-pre-commit -- -mode=fix -v=true"
types: [bazel]
- id: pprettier
name: pprettier
language: system
require_serial: true
# NB: we need to pass a single argument which ends up in $0 when invoking bash -c
entry: "bash -c 'yarn install --silent && yarn run pprettier --write \"$@\"' bash"
types_or: [ts, tsx]
- id: copyrights
name: copyright headers
description: Idempotently add DA copyright headers to source files.
language: system
pass_filenames: false
entry: "dade-copyright-headers update"
types: [text]
- id: platform-independence-check
name: platform-independence-check
language: system
pass_filenames: false
entry: "pre-commit/platform-independence-check.sh"
- id: yarn-lock-check
name: yarn-lock-check
language: system
pass_filenames: false
files: ^(package.json|yarn.lock)$
entry: "pre-commit/yarn-lock-check.sh"
- id: mainonly
name: main only
description: Check for changes under packages with targets tagged with main-only
language: system
pass_filenames: true
entry: "dade-check-main-only-files"
types: [text]