Skip to content

Commit

Permalink
Stub in pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Pizzo committed Jul 16, 2024
1 parent bcf2166 commit b488d8c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pre-commit
rev: v2.17.0
hooks:
- id: validate_manifest
6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- id: codeowners-cli
name: codeowners-cli
description: Runs codeowners-cli to list or validate code owners.
entry: hooks/codeowners-cli-pre-commit
language: script
require_serial: true
14 changes: 14 additions & 0 deletions hooks/codeowners-cli-pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

if ! command -v clj-kondo &> /dev/null
then
echo "codeowners-cli could not be found. Please follow the installation instructions here https://github.com/vincentjames501/codeowners-cli?tab=readme-ov-file#getting-started."
exit 2
fi

if !(codeowners-cli $@)
then
echo
echo "Error: new CODEOWNErS errors found. Please fix them and retry the commit."
exit 1
fi

0 comments on commit b488d8c

Please sign in to comment.