Skip to content

Conversation

@adam-moss
Copy link
Contributor

This adds support for using danger directly with .pre-commit-hooks.yaml configuration file widely used with the python (and other) ecosystems.

More info https://pre-commit.com

This adds support for using danger directly with `.pre-commit-hooks.yaml`
configuration file widely used with the python (and other) ecosystems.

Signed-off-by: Adam Moss <[email protected]>
@orta
Copy link
Member

orta commented Apr 10, 2025

Is this something that people would expect to find via searching through node_modules?

@adam-moss
Copy link
Contributor Author

Is this something that people would expect to find via searching through node_modules?

No, in their repo the would define a .pre-commit-config.yaml file which would look something like:

Example .pre-commit-config.yaml

%YAML 1.2
# yaml-language-server: $schema=https://json.schemastore.org/pre-commit-config.json
---
default_install_hook_types:
  - pre-commit
  - prepare-commit-msg
  - commit-msg
  - post-commit
  - pre-push

default_stages:
  - pre-commit

fail_fast: true

repos:
  - repo: meta
    hooks:
      - id: check-hooks-apply
        stages:
          - manual
      - id: check-useless-excludes
        stages:
          - manual
      - id: identity
        stages:
          - manual

  - repo: https://github.com/danger/danger-js
    rev: v12.3.4
    hooks:
      - id: danger
        additional_dependencies:
          - "@gitlab/codeowners"

You can think of pre-commit as being similar to husky, widely used outside the node ecosystem.

@orta
Copy link
Member

orta commented Apr 11, 2025

Eh, doesn't seem like too much faff for us, sure 👍🏻

@orta orta merged commit da77ef1 into danger:main Apr 11, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants