Skip to content

Custom pre-commit hooks for use by Tatari

Notifications You must be signed in to change notification settings

tatari-tv/pre-commit-hooks

Repository files navigation

Tatari Pre-Commit Hooks

Disclaimer! This is a public repo. Take care about what information and data you put here, since it will be viewable on the internet.

Place to store all of Tatari's custom pre-commit hooks.

Adding a new hook

Depending in which language your hook is written, you will need to commit your hook script in different locations:

  • Python: python_hooks/
    • Ensure you add any dependencies necessary for your hook by running poetry add <dep> followed by poetry lock
  • Bash: root of repo

Then define your hook in .pre-commit-hooks.yaml. Full format of hook definition can be found here.

Python example:

- id: python-example
  name: python-example
  description: Run a Python pre-commit hook
  entry: poetry run python -m python_hooks.python_script.py
  language: python
  pass_filenames: false

Bash example:

- id: bash-example
  name: bash-example
  description: Run a Bash pre-commit hook
  entry: bash-script.sh
  language: system
  pass_filenames: false

Using hooks from this repo

Adding hook definitions to your repo's .pre-commit-config.yaml will add specific hooks from this repo to evaluate your code.

Example:

  - repo: [email protected]:tatari-tv/pre-commit-hooks.git
    rev: v0.1.0
    hooks:
      - id: poetry-pkg-dep-constraint-format