Skip to content

Latest commit

 

History

History
109 lines (74 loc) · 2.28 KB

README.md

File metadata and controls

109 lines (74 loc) · 2.28 KB

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