{"id":16863861,"url":"https://github.com/adehad/pre-commit-hooks","last_synced_at":"2026-04-27T08:31:32.000Z","repository":{"id":180453118,"uuid":"665143491","full_name":"adehad/pre-commit-hooks","owner":"adehad","description":"A collection of pre-commit-hooks.","archived":false,"fork":false,"pushed_at":"2026-04-06T19:30:48.000Z","size":44,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-06T21:22:46.381Z","etag":null,"topics":["copyright-checking","footer-checking","header-checking","license-checking","pre-commit","pre-commit-hook","pre-commit-hooks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adehad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-11T14:26:48.000Z","updated_at":"2025-05-04T13:53:19.000Z","dependencies_parsed_at":"2024-01-15T20:38:24.643Z","dependency_job_id":"076828d7-d091-4bef-a396-71dcfcc49abf","html_url":"https://github.com/adehad/pre-commit-hooks","commit_stats":null,"previous_names":["adehad/pre-commit-hooks"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adehad/pre-commit-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adehad%2Fpre-commit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adehad%2Fpre-commit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adehad%2Fpre-commit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adehad%2Fpre-commit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adehad","download_url":"https://codeload.github.com/adehad/pre-commit-hooks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adehad%2Fpre-commit-hooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32329462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["copyright-checking","footer-checking","header-checking","license-checking","pre-commit","pre-commit-hook","pre-commit-hooks"],"created_at":"2024-10-13T14:40:00.137Z","updated_at":"2026-04-27T08:31:31.983Z","avatar_url":"https://github.com/adehad.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pre_commit_hooks\n\u003c!--\n[![PyPI - Version](https://img.shields.io/pypi/v/pre_commit_hooks.svg)](https://pypi.org/project/pre_commit_hooks)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pre_commit_hooks.svg)](https://pypi.org/project/pre_commit_hooks)\n --\u003e\n\n-----\n\n**Table of Contents**\n\n- [pre_commit_hooks](#pre_commit_hooks)\n  - [Usage](#installation)\n  - [Local Installation](#local-installation)\n  - [Development](#development)\n  - [License](#license)\n\n## Usage\n\n### check-header-footer\n\nSome example usages of this are to check for the License or Copyright header.\nFor the footer the use case presented in the example is for a specific doxygen tag,\n\nArguments:\n- `--lines`: How many lines to search from the top of the file.\n- `--footer-lines`: How many lines to search from the bottom of the file.\n- `--header-config`: `\u003cconfig_filename\u003e:comma,separated,rules` to apply to the header check.\n- `--footer-config`: `\u003cconfig_filename\u003e:comma,separated,rules` to apply to the footer check.\n\nThe config file is a json of `{rule: expected lines}`. The lines are separated using an array.\nInternally we use a regex comparison to find the exact strings.\n\n```json\n// config.json Example\n{\n    \"license\": [\n        \"# SPDX-FileCopyrightText: 2022-present adehad \u003c26027314+adehad@users.noreply.github.com\u003e\",\n        \"#\",\n        \"# SPDX-License-Identifier: GPL-3.0-or-later\"\n    ],\n    \"c_license\": [\n        \"/*\",\n        \" * Copyright (c) 2023 COMPANY_NAME\",\n        \" * All rights reserved\",\n        \" */\"\n    ],\n    \"doxygen\": [\n        \"/// @}\"\n    ]\n}\n```\n\nWith pre-commit we can specify the `types_or` for specific file types, and restrict\nto a subset of files. Running header and footer checks at the same time.\n\n```yaml\nrepos:\n  - repo: https://github.com/adehad/pre-commit-hooks\n    rev: main\n    hooks:\n      - id: check-header-footer\n        files: ^Source/(?!Generated).*\n        types_or: [c, c++]\n        args:\n          - --header-config=config.json:c_license\n          - --footer-config=config.json:doxygen\n```\n\nor for verbosity the header and footer stages can be isolated, this can be used for\nchecking the header and footer separated (see below) or can be used to select different\nrules for different languages.\n\n```yaml\nrepos:\n  - repo: https://github.com/adehad/pre-commit-hooks\n    rev: main\n    hooks:\n      - id: check-header-footer\n        name: Checking for License\n        files: ^Source/(?!Generated).*\n        types_or: [c, c++]\n        args:\n          - --header-config=config.json:c_license\n  - repo: https://github.com/adehad/pre-commit-hooks\n    rev: main\n    hooks:\n      - id: check-header-footer\n        name: Checking for Doxygen file group\n        files: ^Source/(?!Generated).*\n        types_or: [c, c++]\n        args:\n          - --footer-config=config.json:doxygen\n```\n\nFuture work:\n1. Support a year parameter that can be used to apply fixes.\n\n\n### arabic-presentation-form\n\nReplace characters in Arabic Presentation form (A or B), and convert them into 'default' unicode characters.\nOne application is when using the 'Scheherazade New' font, and it does not support these characters.\n\nArguments:\n- `--excluded-chars`: Regex of characters to exclude from being fixed.\n- `--custom-rules`: Rules to update or override the tools inbuilt configuration. Format and example below:\n  ```json\n  \"RuleName\": {\"rule\": {\"ReplacementCharacter(s)\": \"RegexOfApplicableCharacter(s)\"}}\n  \"ʾalif\": {\"rule\": {\"\\u0627\": \"(\\ufe8d|\\ufe8e)\"}},\n  ```\n\nExample where we are extending the applicable file types and using a specific folder (all subfolders under `site/data`)\n\n```yaml\nrepos:\n  - repo: https://github.com/adehad/pre-commit-hooks\n    rev: main\n    hooks:\n      - id: arabic-presentation-form\n        entry: arabic-presentation-form\n        language: python\n        types_or: [text, json, markdown]\n        args: [--excluded-chars, (ﷺ)]\n        files: ^site/data/\n```\n\n## Local Installation\n\n```console\npipx install git+https://github.com/adehad/pre-commit-hooks.git@main\n```\n\n## Development\n\n```console\nhatch shell\n```\n\n```console\nhatch run lint\nhatch run docs\nhatch run cov\n```\n\n\n## License\n\n`pre_commit_hooks` is distributed under the terms of the [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later.html) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadehad%2Fpre-commit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadehad%2Fpre-commit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadehad%2Fpre-commit-hooks/lists"}