2024-01-15 22:27:42 +03:00
|
|
|
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
2022-12-07 16:09:50 +03:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
# See https://pre-commit.com for more information
|
|
|
|
# See https://pre-commit.com/hooks.html for more hooks
|
|
|
|
|
2024-04-11 15:05:58 +03:00
|
|
|
exclude: '^sdk/canton/(community|daml-common-staging)'
|
2022-12-07 16:09:50 +03:00
|
|
|
repos:
|
|
|
|
- repo: local
|
|
|
|
hooks:
|
|
|
|
- id: hlint
|
|
|
|
name: hlint
|
|
|
|
language: system
|
2024-03-26 09:55:20 +03:00
|
|
|
entry: "hlint -j --hint=sdk/.hlint.yaml"
|
2022-12-07 16:09:50 +03:00
|
|
|
require_serial: true
|
|
|
|
types: [haskell]
|
|
|
|
- id: scalafmt
|
|
|
|
name: scalafmt
|
|
|
|
language: system
|
|
|
|
require_serial: true
|
2024-03-26 09:55:20 +03:00
|
|
|
entry: "scalafmt --config=sdk/.scalafmt.conf --respect-project-filters"
|
2022-12-07 16:09:50 +03:00
|
|
|
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
|
2024-03-26 09:55:20 +03:00
|
|
|
entry: "bash -c 'cd sdk/; bazel run //:buildifier-pre-commit -- -mode=fix -v=true'"
|
2022-12-07 16:09:50 +03:00
|
|
|
types: [bazel]
|
|
|
|
- id: pprettier
|
|
|
|
name: pprettier
|
|
|
|
language: system
|
|
|
|
require_serial: true
|
2023-01-10 19:40:16 +03:00
|
|
|
# NB: we need to pass a single argument which ends up in $0 when invoking bash -c
|
2024-03-26 09:55:20 +03:00
|
|
|
entry: "bash -c 'yarn install --silent && files=(\"$@\") && yarn run --cwd=sdk pprettier --write ${files[@]##sdk/}' bash"
|
2023-01-10 19:40:16 +03:00
|
|
|
types_or: [ts, tsx]
|
2022-12-07 16:09:50 +03:00
|
|
|
- id: copyrights
|
|
|
|
name: copyright headers
|
|
|
|
description: Idempotently add DA copyright headers to source files.
|
|
|
|
language: system
|
|
|
|
pass_filenames: false
|
2024-04-26 11:18:16 +03:00
|
|
|
entry: "bash -c 'unset GIT_DIR; dade-copyright-headers update'"
|
2022-12-07 16:09:50 +03:00
|
|
|
types: [text]
|
2023-12-07 20:18:24 +03:00
|
|
|
- id: platform-independence-check
|
|
|
|
name: platform-independence-check
|
|
|
|
language: system
|
|
|
|
pass_filenames: false
|
2024-03-26 09:55:20 +03:00
|
|
|
entry: "sdk/pre-commit/platform-independence-check.sh"
|
2024-01-10 12:16:09 +03:00
|
|
|
- id: yarn-lock-check
|
|
|
|
name: yarn-lock-check
|
|
|
|
language: system
|
2024-03-26 09:55:20 +03:00
|
|
|
pass_filenames: true
|
|
|
|
files: ^sdk/(package.json|yarn.lock)$
|
|
|
|
entry: "sdk/pre-commit/yarn-lock-check.sh"
|
2023-12-08 10:35:54 +03:00
|
|
|
- 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]
|