daml/.pre-commit-config.yaml
Raphael Speyer 51bf3da977
precommit: add check for modified files under packages with main-only targets. (#17993)
Since https://github.com/digital-asset/daml/pull/17989

A simple heuristic to remind you to consider adding `run-all-tests: true` to your commit message if making changes in corners of the codebase most likely affected.
2023-12-08 18:35:54 +11:00

61 lines
1.9 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: 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]