Skip to content

batovpasha/pre-commit-jira

Folders and files

NameName
Last commit message
Last commit date
Jan 9, 2025
Jan 14, 2025
Jan 11, 2025
Dec 16, 2024
Jan 2, 2025
Jan 14, 2025
Jan 14, 2025
Jan 14, 2025
Dec 8, 2024
Jan 14, 2025
Dec 3, 2024
Mar 5, 2025
Jan 14, 2025
Jan 14, 2025

Repository files navigation

pre-commit-jira

CircleCI

Collection of pre-commit hooks for JIRA workflow.

Prerequisites

Installation

  1. Put the following configuration into your .pre-commit-config.yaml file:

    repos:
      - repo: https://github.com/batovpasha/pre-commit-jira
        rev: v1.0.0
        hooks:
          - id: add-jira-ticket
  2. Update the hooks to latest version:

    pre-commit autoupdate
  3. Install the hooks:

    pre-commit install --hook-type commit-msg
  4. Start using. Example:

    git checkout -b feature/TICKET-123-some-feature
    git commit --allow-empty -m "feat: add new feature"
    
    # The next command will show the latest commit message
    git log -1 --pretty=%B # => feat: TICKET-123 add new feature

Testing

Testing Prerequisites

Unit tests (without coverage)

lein test

Unit tests (with coverage)

lein cloverage
# Open the coverage report ./target/coverage/index.html
open ./target/coverage/index.html     # MacOS
xdg-open ./target/coverage/index.html # Linux

End-to-End tests

./e2e-test.sh || rm -rf /tmp/pre-commit-jira-test

Development

Development Prerequisites

The same as for testing + need to set up dev pre-commit hooks:

pre-commit install --install-hooks

Run hooks locally

add-jira-ticket

  1. (Optional) Edit the commit-msg.txt whatever you want

  2. Run the hook:

    pre-commit try-repo . add-jira-ticket --verbose --all-files \
      --commit-msg-filename ./commit-msg.txt \
      --hook-stage commit-msg

Lint

lein clj-kondo

Format

lein zprint src/**/*.clj test/**/*.clj project.clj