{"id":26695273,"url":"https://github.com/itszcx/pre-commit-hooks","last_synced_at":"2026-04-08T18:04:26.908Z","repository":{"id":221188727,"uuid":"753685654","full_name":"ItsZcx/pre-commit-hooks","owner":"ItsZcx","description":"Useful pre-commit hooks for personal use","archived":false,"fork":false,"pushed_at":"2024-05-16T00:09:47.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T23:20:38.881Z","etag":null,"topics":["c","cpp","devops","epitech","haskell","linter","pre-commit","pre-commit-hooks","python","refactoring"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ItsZcx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-02-06T15:54:22.000Z","updated_at":"2025-02-05T23:05:10.000Z","dependencies_parsed_at":"2024-02-06T17:29:39.048Z","dependency_job_id":"c234d004-b73d-4bf8-9cf4-6f8394286250","html_url":"https://github.com/ItsZcx/pre-commit-hooks","commit_stats":null,"previous_names":["itszcx/pre-commit-hooks"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/ItsZcx/pre-commit-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsZcx%2Fpre-commit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsZcx%2Fpre-commit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsZcx%2Fpre-commit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsZcx%2Fpre-commit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ItsZcx","download_url":"https://codeload.github.com/ItsZcx/pre-commit-hooks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsZcx%2Fpre-commit-hooks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262460373,"owners_count":23314722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["c","cpp","devops","epitech","haskell","linter","pre-commit","pre-commit-hooks","python","refactoring"],"created_at":"2025-03-26T19:18:21.024Z","updated_at":"2025-12-30T22:22:37.561Z","avatar_url":"https://github.com/ItsZcx.png","language":"Shell","readme":"# Pre-Commit-Hooks\n\nPre-commit-hooks is a project designed to enhance code quality and consistency by providing a collection of pre-commit hooks, those hooks can be run locally as well as with Docker.\n\n## Table of Contents\n\n- [Installation](#installation)\n  - [Run via Docker](#run-via-docker)\n  - [Run locally](#run-locally)\n- [Usage](#usage)\n  - [How to use c-config](#how-to-use-c-config)\n  - [How to use cpp-config](#how-to-use-cpp-config)\n  - [How to use python-config](#how-to-use-python-config)\n  - [How to use haskell-config](#how-to-use-haskell-config)\n- [Executing the Pre-Commit-Hooks](#executing-the-pre-commit-hooks)\n  - [Executing with Docker](#executing-with-docker)\n  - [Executing locally](#executing-locally)\n- [Contributing](#contributing)\n\n## Installation\n\nThere are two way to utilize the pre-commit hooks, locally, downloading necessary dependecies and with Docker, without downloading anything.\n\nIf you want to have the hooks run in every single commit, refere to running it locally, if you prefere to decide when the hooks will run, refere to running it via Docker.\n\nFor both options, you will have to copy some files/scripts present in this repository.\n\n### Run via Docker\n\nTo run the pre-commit hooks via Docker, you only need to have `Docker` installed on your computer. Refer to the official Docker documentation for installation instructions.\n\nYou can execute the hooks using a provided script whenever you deem it appropriate.\n\n### Run locally\n\nTo utilize the pre-commit hooks locally, you'll need to install `pre-commit` with the following command:\n\n```sh\npip install pre-commit\n```\n\n## Usage\n\nOnce the pre-commit hooks are set up, they will only run on the **TRACKED FILES IN THE REPOSITORY**. If a hook detects an error locally, the commit process will be stopped.\n\nA general project usage `.pre-commit-config.yaml` file is available at the root of the repository for reference and use if needed.\n\n### How to use c-config\n\nFor C projects, you'll need to integrate these hooks into your project:\n1. Copy the `.pre-commit-config.yaml` file from the `c-config` directory to your project root.\n\n### How to use cpp-config\n\nFor C++ projects, you'll need to integrate these hooks into your project:\n1. Copy the `.pre-commit-config.yaml` file from the `cpp-config` directory to your project root.\n\n2. The `.pre-commit-config.yaml` file is preconfigured to utilize a personalized `.clang-format` file if there is one present in the root of the repository. Otherwise it will use the default Microsoft formatter. There is a `.clang-format` file in the folder.\n\n### How to use python-config\n\nFor Python projects, you'll need to integrate these hooks into your project:\n1. Copy the `.pre-commit-config.yaml` file from the `python-config` directory to your project root.\n\n2. The `.pre-commit-config.yaml` file is preconfigured to utilize a personalized `.ruff.toml` file if there is one present in the root of the repository. Otherwise it will use the default ruff settings for formatting and linting. There is a `.ruff.toml` file in the folder.\n\n### How to use haskell-config\n\nFor Haskell projects, you'll need to integrate these hooks into your project:\n1. Copy the `.pre-commit-config.yaml` file from the `haskell-config` directory to your project root.\n\n2. Fourmolu is preconfigured to utilize a personalized `fourmolu.yaml` file if there is one present in the root of the repository. Otherwise it will use the default fourmolu formatting configuration. There is a `fourmolu.yaml` file in the folder in case you want one.\n\n### How to use x-config with Docker or locally\n\nRefer to this documentation if you want to run them with Docker\n  - [Executing with Docker](#executing-with-docker)\n\nRefer to this documentation if you want to run them locally\n  - [Executing locally](#executing-locally)\n\n## Executing the Pre-Commit-Hooks\n\n### Executing with Docker\n\nTo use it with Docker, you will additionally need to copy the script `pre-commit.sh` into your root repository.\n\nWhenever you wish to run the hooks, simply execute the script as follows:\n```sh\n./pre-commit.sh\n```\n\nThe script will create a container with a published image, connected to your code via a volume, where the hooks will be executed. After execution, the script will display the output of the hooks and their status.\n\nPlease note that the script will create two temporary files, `.pre-commit-keeper.log` and `.pre-commit-output.log`. These files will be automatically deleted upon the completion of the script.\n\n### Executing locally\n\nOnce you've copied over the required files, the next step is to configure your Git repository to utilize the pre-commit hooks locally. Follow these steps:\n\n1. Run the command below to set up pre-commit in your **local** git repository:\n\n```sh\npre-commit install\n```\n\n2. After installing pre-commit, it's advisable to run the following command:\n\n```sh\npre-commit run --all-files\n```\n\nThis command ensures that all hooks are executed for all files previously added to the repository. If there is any error about not finding a binary, you will probably have to locally install that necessary application with apt, stack, pip... etc.\n\nTo ensure that you have the latest versions of the hooks, you can periodically run the following command:\n\n```sh\npre-commit autoupdate\n```\n\nThis command updates the hooks to their latest versions, keeping your pre-commit setup current with any improvements or bug fixes.\n\n## Contributing\n\nContributions are welcome. Please follow the existing coding standards and add pre-commit hooks for any new files.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitszcx%2Fpre-commit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitszcx%2Fpre-commit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitszcx%2Fpre-commit-hooks/lists"}