Skip to content
/ cz-path Public

Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.

License

Notifications You must be signed in to change notification settings

Tatsh/cz-path

Repository files navigation

cz-path

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Dependabot Documentation Status mypy pre-commit Poetry pydocstyle pytest Ruff Downloads Stargazers Prettier

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.

Installation

Poetry

Example with dev group:

poetry add -G dev cz-path

Pip

pip install cz-path

Usage

Pass -n cz_path to cz or add it to your configuration file.

By default, src/ will be removed from any determined prefix. This can be customised by setting remove_path_prefixes to []. You also may want to add other locations such as a module name. Adding / is not required.

pyproject.toml

[tool.commitizen]
name = "cz_path"
remove_path_prefixes = ["src", "module_name"]

.cz.json

{
  "commitizen": {
    "name": "cz_path",
    "remove_path_prefixes": ["src", "module_name"]
  }
}

Scenarios

Staged files Path prefix String prefix
src/a.c, src/b.c src src/
src/a1.c, src/a2.c src src/a
a.c, b.c (no option) (no option)

If no prefix is found amongst the staged files, only the choices project and empty will be given.

About

Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors 2

  •  
  •