*********************
pre-commit-git-checks
*********************
A series of basic Git checks meant for linting of your work.
.. contents::
:depth: 3
Installation
============
This tool can be installed as a Python package or a pre-commit hook.
Python package
--------------
Install using ``pip`` with:
.. code:: shell
pip install pre-commit-git-checks
pre-commit hook
---------------
`pre-commit <https://pre-commit.com/#intro>`_ is a framework that is used for the
automated identification of issues in software.
``pre-commit-git-checks`` can be run as a Git hook script before submitting
your code.
To install ``pre-commit`` follow the steps `here <https://pre-commit.com/#install>`__.
You can see how to integrate a specific hook in the section below.
Usage
=====
Python CLI
--------------
You can run this tool from the command line.
To see the help dialog:
.. code:: shell
$ pgchecks --help
Usage: pgchecks [OPTIONS] COMMAND [ARGS]...
A pre-commit checking tool for Git
Options:
--help Show this message and exit.
Commands:
signoff Checks your Git commit messages for a signoff
Example usage:
.. code:: shell
$ pgchecks signoff
[ERROR] Sign-off message expected to be 'Signed-off-by: Kostas Doe <kdoe@email.com>'.
[INFO] Check your current git configuration (`git config -l`) and run `git commit --signoff` to signoff.
Hooks
-----
In your ``.pre-commit-config.yaml`` file add:
.. code:: text
repos:
- repo: https://github.com/KAUTH/pre-commit-git-checks
rev: master
hooks:
- id: git-signoff
stages: [commit-msg]
To install the hook(s) run:
* For ``git-signoff``:
.. code:: shell
pre-commit install --hook-type commit-msg
.. note::
Running the ``pre-commit install --hook-type <hook-type>`` command will
install all the hooks that include in their ``stages`` the ``<hook-type>``
value (e.g., ``commit-msg``). Keep in mind that hooks that do not have
``stages`` defined are by default set to all stages, and therefore will
always also be installed to the given ``<hook-type>`` as well.
You can find more details `here <https://pre-commit.com/#confining-hooks-to-run-at-certain-stages>`_.
To run individual hooks use:
.. code:: shell
pre-commit run --hook-stage <stage> <hook_id>
git-signoff
~~~~~~~~~~~
What
""""
With the command ``git commit --signoff/-s`` a committer adds a ``Signed-off-by``
trailer at the end of the commit log message.
This hook ensures that the committed message has been signed off with the
information of the Git user.
The corresponding CLI command ensures that the commit message that is currently
checked out has been signed off with the information of the Git user.
.. note::
The purpose of this hook is to identify commit messages that have not been
explicitly signed off by the committer, and not to automatically add a Signed-off-by
line to the message.
Why
"""
As mentioned in the ``git commit`` `documentation <https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff>`_:
The meaning of a signoff depends on the project to which you’re committing.
For example, it may certify that the committer has the rights to submit the work
under the project’s license or agrees to some contributor representation, such as a
Developer Certificate of Origin. (See http://developercertificate.org for the one used
by the Linux kernel and Git projects.) Consult the documentation or leadership of the
project to which you’re contributing to understand how the signoffs are used in that project.
How
"""
The pre-commit hook and script command checks:
* If a ``user.name`` Git configuration is set at a local level first or a global
level and throws an error in the case it is not set in any scope.
The same happens for the ``user.email`` configuration.
* If the ``user.name`` configuration resembles the format 'Your Name' and throws
a warning in case it does not.
* If the ``user.email`` configuration resembles the format of an email and
throws a warning in case it does not.
* If the Git commit message is singed off with the currently set up ``user.name``
and ``user.email`` configurations and throws an error in case it does not.
Sign-off message is expected to be: 'Signed-off-by: {user.name} <{user.email}>'
When
""""
The hook runs right after you save your commit message, as a ``commit-msg``
hook (see https://git-scm.com/docs/githooks#_commit_msg). If the script exits
non-zero, Git aborts the commit process.
For more information check out the ``pre-commit`` documentation, https://pre-commit.com/#pre-commit-for-commit-messages.
License
=======
`MIT License <https://github.com/KAUTH/pre-commit-git-checks/blob/master/LICENSE>`_
Raw data
{
"_id": null,
"home_page": "https://github.com/KAUTH/pre-commit-git-checks",
"name": "pre-commit-git-checks",
"maintainer": "Konstantinos Papadopoulos",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "konpap1996@yahoo.com",
"keywords": "precommit,hooks,git",
"author": "Konstantinos Papadopoulos",
"author_email": "konpap1996@yahoo.com",
"download_url": "https://files.pythonhosted.org/packages/21/47/e5ebff7ff79f076155ed5bd2bdcc37b591e7c5e9507d79a7e62fb3a6674f/pre_commit_git_checks-0.0.1.tar.gz",
"platform": null,
"description": "*********************\npre-commit-git-checks\n*********************\n\nA series of basic Git checks meant for linting of your work.\n\n.. contents::\n :depth: 3\n\nInstallation\n============\nThis tool can be installed as a Python package or a pre-commit hook.\n\nPython package\n--------------\n\nInstall using ``pip`` with:\n\n.. code:: shell\n\n pip install pre-commit-git-checks\n\npre-commit hook\n---------------\n`pre-commit <https://pre-commit.com/#intro>`_ is a framework that is used for the\nautomated identification of issues in software.\n\n``pre-commit-git-checks`` can be run as a Git hook script before submitting\nyour code.\n\nTo install ``pre-commit`` follow the steps `here <https://pre-commit.com/#install>`__.\n\nYou can see how to integrate a specific hook in the section below.\n\nUsage\n=====\n\nPython CLI\n--------------\nYou can run this tool from the command line.\n\nTo see the help dialog:\n\n.. code:: shell\n\n $ pgchecks --help\n\n Usage: pgchecks [OPTIONS] COMMAND [ARGS]...\n\n A pre-commit checking tool for Git\n\n Options:\n --help Show this message and exit.\n\n Commands:\n signoff Checks your Git commit messages for a signoff\n\nExample usage:\n\n.. code:: shell\n\n $ pgchecks signoff\n\n [ERROR] Sign-off message expected to be 'Signed-off-by: Kostas Doe <kdoe@email.com>'.\n [INFO] Check your current git configuration (`git config -l`) and run `git commit --signoff` to signoff.\n\nHooks\n-----\n\nIn your ``.pre-commit-config.yaml`` file add:\n\n.. code:: text\n\n repos:\n - repo: https://github.com/KAUTH/pre-commit-git-checks\n rev: master\n hooks:\n - id: git-signoff\n stages: [commit-msg]\n\nTo install the hook(s) run:\n\n* For ``git-signoff``:\n\n.. code:: shell\n\n pre-commit install --hook-type commit-msg\n\n\n.. note::\n Running the ``pre-commit install --hook-type <hook-type>`` command will\n install all the hooks that include in their ``stages`` the ``<hook-type>``\n value (e.g., ``commit-msg``). Keep in mind that hooks that do not have\n ``stages`` defined are by default set to all stages, and therefore will\n always also be installed to the given ``<hook-type>`` as well.\n You can find more details `here <https://pre-commit.com/#confining-hooks-to-run-at-certain-stages>`_.\n\nTo run individual hooks use:\n\n.. code:: shell\n\n pre-commit run --hook-stage <stage> <hook_id>\n\ngit-signoff\n~~~~~~~~~~~\nWhat\n\"\"\"\"\nWith the command ``git commit --signoff/-s`` a committer adds a ``Signed-off-by``\ntrailer at the end of the commit log message.\n\nThis hook ensures that the committed message has been signed off with the\ninformation of the Git user.\n\nThe corresponding CLI command ensures that the commit message that is currently\nchecked out has been signed off with the information of the Git user.\n\n.. note::\n The purpose of this hook is to identify commit messages that have not been\n explicitly signed off by the committer, and not to automatically add a Signed-off-by\n line to the message.\n\nWhy\n\"\"\"\nAs mentioned in the ``git commit`` `documentation <https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff>`_:\n\n The meaning of a signoff depends on the project to which you\u2019re committing.\n For example, it may certify that the committer has the rights to submit the work\n under the project\u2019s license or agrees to some contributor representation, such as a\n Developer Certificate of Origin. (See http://developercertificate.org for the one used\n by the Linux kernel and Git projects.) Consult the documentation or leadership of the\n project to which you\u2019re contributing to understand how the signoffs are used in that project.\n\nHow\n\"\"\"\nThe pre-commit hook and script command checks:\n\n* If a ``user.name`` Git configuration is set at a local level first or a global\n level and throws an error in the case it is not set in any scope.\n The same happens for the ``user.email`` configuration.\n\n* If the ``user.name`` configuration resembles the format 'Your Name' and throws\n a warning in case it does not.\n\n* If the ``user.email`` configuration resembles the format of an email and\n throws a warning in case it does not.\n\n* If the Git commit message is singed off with the currently set up ``user.name``\n and ``user.email`` configurations and throws an error in case it does not.\n\nSign-off message is expected to be: 'Signed-off-by: {user.name} <{user.email}>'\n\nWhen\n\"\"\"\"\nThe hook runs right after you save your commit message, as a ``commit-msg``\nhook (see https://git-scm.com/docs/githooks#_commit_msg). If the script exits\nnon-zero, Git aborts the commit process.\n\nFor more information check out the ``pre-commit`` documentation, https://pre-commit.com/#pre-commit-for-commit-messages.\n\nLicense\n=======\n`MIT License <https://github.com/KAUTH/pre-commit-git-checks/blob/master/LICENSE>`_\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A series of basic Git checks meant for linting of your work.",
"version": "0.0.1",
"split_keywords": [
"precommit",
"hooks",
"git"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "ff6646df5800b6a2d98cb015e667d256",
"sha256": "6e927ceb64a324267b92569ec7fb60ebef4e8a763ba601b726f67efd0edeaa0e"
},
"downloads": -1,
"filename": "pre_commit_git_checks-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ff6646df5800b6a2d98cb015e667d256",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 7866,
"upload_time": "2022-12-25T23:24:55",
"upload_time_iso_8601": "2022-12-25T23:24:55.465082Z",
"url": "https://files.pythonhosted.org/packages/09/88/91a4fa95ddc465d1bf16e64c36277690ddc64cf5141d6b2a6b60715fd433/pre_commit_git_checks-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "8965269af912cc1c3c2e7b94ea32b4f2",
"sha256": "5dc4837bb6c9eec01a96154fce75e10c1c1e2e2f95cbe3506bc3bcbe38b54cf8"
},
"downloads": -1,
"filename": "pre_commit_git_checks-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "8965269af912cc1c3c2e7b94ea32b4f2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 7258,
"upload_time": "2022-12-25T23:24:57",
"upload_time_iso_8601": "2022-12-25T23:24:57.255634Z",
"url": "https://files.pythonhosted.org/packages/21/47/e5ebff7ff79f076155ed5bd2bdcc37b591e7c5e9507d79a7e62fb3a6674f/pre_commit_git_checks-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-25 23:24:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "KAUTH",
"github_project": "pre-commit-git-checks",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "pre-commit-git-checks"
}