Skip to main content

detect-direct-checkins

Overview

The detect-direct-checkins utility can be used to detect non-merge commits on given branches in a Git repository. It can be run as a pre-commit framework hook.

Example Usage

Command line tool

Install the command line program with

python3 -m pip install "git+https://github.com/IngoMeyer441/detect-direct-checkins@master"

Switch your working directory to a Git repository you would like to check and run

detect-direct-checkins --branch release --allow-root

to check a branch release for non-merge commits (but ignore initial root commits without parents).

Usage as a pre-commit hook

Add

- repo: https://github.com/IngoMeyer441/detect-direct-checkins
  rev: 0.1.0
  hooks:
  - id: detect-direct-checkins
  - args: ['--branch=release', '--allow-root']

to your .pre-commit-config.yaml to detect direct checkins to a branch release. The --allow-root switch ignores root commits (initial commits without parents).

The --branch argument can be given multiple times to check more than one branch.

This check is a post-commit check, so make sure to install the pre-commit framework as a post-commit hook:

pre-commit install --hook-type post-commit

I recommend to set default_stages: ['commit'] in your .pre-commit-config.yaml. Otherwise, most checks will run twice (in the pre-commit and post-commit stage).

Important note: Since this is a post-commit hook, this check will not avoid the creation of disallowed commits. It only tells you that a disallowed commit has been created. However, you can run

pre-commit run --hook-type post-commit

as part of your CI pipeline to enforce this check. Direct-checkins to protected branches will cause this check to fail in a CI job.

Options

These options are supported:

  • --branch: Branch which must only contain merge commits, can be given multiple times.
  • --ignore: Commit hashes which will be ignored, can be given multiple times
  • --allow-root: Allow root commits (commits without parents).

Contributing

Please open an issue on GitHub if you experience bugs or miss features. Please consider to send a pull request if you can spend time on fixing the issue yourself. This project uses pre-commit itself to ensure code quality and a consistent code style. Run

make git-hooks-install

to install all linters as Git hooks in your local clone of detect-direct-checkins.

Metadata

Release files for detect-direct-checkins 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for detect-direct-checkins 0.1.0
File Size Uploaded Provenance Actions
detect-direct-checkins-0.1.0.tar.gz 4.8 kB Without provenance Details for detect-direct-checkins-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for detect-direct-checkins 0.1.0
File Interpreter ABI Platform Actions
detect_direct_checkins-0.1.0-py3-none-any.whl Python 3 none any Details for detect_direct_checkins-0.1.0-py3-none-any.whl

Total release size: 10.0 kB

Release files / detect-direct-checkins-0.1.0.tar.gz

Download URL detect-direct-checkins-0.1.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c7186853c886c2272c12d38ad6a691119b6d2d827afb783179f7aa1fee4d0039
BLAKE2b-256 checksum
How to use checksums
2c48ee8963b1fecb8b26de63e6fdd1a16e5bd91bdfd17e0faec344048273fb86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Release files / detect_direct_checkins-0.1.0-py3-none-any.whl

Download URL detect_direct_checkins-0.1.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffa45603af214ae885967876aca949cd4be368e12920227d466e4a0863cb552f
BLAKE2b-256 checksum
How to use checksums
a63757ec73738f0e1c16425a15eca3cd0e5b606f78cb9dba8087c3f586d5545c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Security for detect-direct-checkins 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page