Metadata-Version: 2.1
Name: hooks-vb
Version: 0.0.1
Summary: Pre-commit app hooks.
Home-page: https://github.com/violet-black/hooks-vb
Author: Violet Black
Author-email: violetblackdev@gmail.com
License: Apache-2.0
Keywords: pre-commit,git,hooks
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.6
Description-Content-Type: text/x-rst
Provides-Extra: dev
License-File: LICENSE


Some useful (more or less) git hooks.

Hooks
-----

check-commit-msg
^^^^^^^^^^^^^^^^

It provides a simple regex check on commit message.

Supported message header formats:

.. code-block::

  [type]: [description]
  [type]([context]): [description]
  [type] #[issue_id]: [description]
  [type]([context]) #[issue_id]: [description]

Supported message format (if you need a longer commit message):

.. code-block::

  [header]

  [message]


Here `type` is a specific commit type tag. Recognized types are:

.. code-block::

    'fix',                      # bugfix
    'feat', 'feature',          # feature
    'wip',                      # work-in-progress changes (not ready to use)
    'maint', 'maintenance',     # code maintenance (dependences, configs)
    'backport',                 # backport to an older branch
    'test', 'tests',            # code test related
    'doc', 'docs',              # documentation related
    'style'                     # code style and minor refactoring

The `context` keyword is optional. It must be in round brackets if present.
You may provide a module name or a service name or any project-specific
information to localize the scope of a problem.

The `issue_id` must be prepended with `#` if present and it should match
an bug report / feature request ID connected to this specific commit.

The `description` is just a short description of your commit. The maximum length
of a description part of a header is 60 symbols.

You also can provide any additional information after the header.

Here are some examples:

.. code-block::

  fix: fixed possible connection drops in db


  feat(cache): added multi-value caching


  feature(db) #112: support for sqlalchemy v.2

  Added sqlalchemy v.2 support in database services
  incl. new table init engine and other bla-bla-bla...
  <write text here>


Usage
_____

Add it to your `.pre-commit-config.yaml` for `pre-commit <https://pre-commit.com>`_:

.. code-block::

  - repo: https://github.com/violet-black/hooks-vb
    rev: 0.0.1
    hooks:
      - id: check-commit-msg


Also you can install the package via pip and run the hook from the CLI:

.. code-block::

  pip install -e git://github.com/violet-black/hooks-vb.git@0.0.1#egg=hooks_vb
  check-commit-msg my_project_dir


Options
_______

- `--msg-fmt` - different regex format
- `--categories` - different list of type tags


add-version-tag
^^^^^^^^^^^^^^^

It automatically adds a version tag to a commit if
the `__version__` variable in `__init__.py`
has changed and if there's no such version tag exists in repo.
Version tags are checked against a subset of `PEP440 <https://www.python.org/dev/peps/pep-0440>`_
instructions. By default it supports major / minor / subminor versions and RCs.

Examples:

.. code-block::

  1.0.0
  1.2
  1.1rc2


Usage
_____

Add it to your `.pre-commit-config.yaml` for `pre-commit <https://pre-commit.com>`_:

.. code-block::

  - repo: https://github.com/violet-black/hooks-vb
    rev: 0.0.1
    hooks:
      - id: add-version-tag
        args: [ 'my_package' ]


Also you can install the package via pip and run the hook from the CLI:

.. code-block::

  pip install -e git://github.com/violet-black/hooks-vb.git@0.0.1#egg=hooks_vb
  add-version-tag my_project_dir


Options
_______

- `--skip-tag` - skip tagging and only validate a version against PEP
- `--skip-validation` - tag version without format validation
- `--version-file` - change version file location (__init__.py)
- `--version-var` - change version variable name (__version__)
- `--version-fmt` - change version format regex
- `--remote` - change default git remote name to pre-pull tags from (origin)
- `--branch` - change default branch name (master)


Development
-----------

You must setup the package in the dev mode and with dev dependencies.
The script will automatically install pre-commit and pre-commit hooks for the
repository.


.. code-block::

  git clone https://github.com/violet-black/hooks-vb.git
  pip install -e .[dev]


