Skip to content

DSD-DBS/capella-git-hooks

Repository files navigation

Capella Git Hooks

image image

In this repository we provide git hooks, which can be useful when using git for storing Capella models. All hooks are designed to be included using the pre-commit framework. To include git a git hook from this repository, you have to add a .pre-commit-config.yaml file to the root of your repository. In this file you have to reference this repository to use hooks from here:

repos:
  - repo: https://github.com/DSD-DBS/capella-git-hooks.git
    rev: 862cf641c298f9666656b46b1bde3639c7592b01
    hooks:
      - id: ...

Available Hooks

In the following we will shortly summarize the available hooks and how to include them.

fix-links

This post-commit hook is a workaround, which checks all files for broken links starting with index:/. These can occur after using the merge tool as described in this issue. The general process looks as follows:

  1. Get all git tracked files not having uncommitted changes (as it is a post-commit hook, this includes changes committed in the triggering git command)
  2. Search and replace index:/ in all XML attributes - we ensure that the XML-structure does not change
  3. If files were changed, these are written to disk and committed in a separate commit using a predefined commit message ("fix[by-script]: merge tool index-prefix")

To use this hook add fix-links to the list of hooks in your .pre-commit-config.yaml.

repos:
  - repo: https://github.com/DSD-DBS/capella-git-hooks.git
    rev: 862cf641c298f9666656b46b1bde3639c7592b01
    hooks:
      - id: fix-links

Setting up a Development Environment

To set up a development environment, clone the project and install it into a virtual environment.

git clone https://github.com/DSD-DBS/capella-git-hooks
cd capella-git-hooks
python -m venv .venv

source .venv/bin/activate.sh  # for Linux / Mac
.venv\Scripts\activate  # for Windows

pip install -U pip pre-commit
pip install -e '.[docs,test]'
pre-commit install

Contributing

We'd love to see your bug reports and improvement suggestions! Please take a look at our guidelines for contributors for details.

Licenses

This project is compliant with the REUSE Specification Version 3.0.

Copyright DB Netz AG, licensed under Apache 2.0 (see full text in LICENSES/Apache-2.0.txt)

Dot-files are licensed under CC0-1.0 (see full text in LICENSES/CC0-1.0.txt)

About

A collection of useful Capella related Git hooks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages